Commit graph

109 commits

Author SHA1 Message Date
Vlad Zahorodnii
2814030fef Drop {client,window}DemandsAttentionChanged
There are no its users. Also same can be achieved by listening to
Window::demandsAttentionChanged signal.
2023-08-23 11:58:08 +00:00
Xaver Hugl
4541501ccc get rid of some unnecessary const_casts 2023-06-14 14:36:36 +00:00
Xaver Hugl
f60bcfb646 handle laptop lid closing in KWin
Instead of KScreen turning the display off, do that in KWin directly
2023-05-09 15:18:33 +00:00
Vlad Zahorodnii
dbbcf31d0d x11: Merge Unmanaged into X11Window
Currently, managed and override-redirect windows are split in two types:
X11Window and Unmanaged. While looking at it strictly from type
perspective, this is great. But it creates other problems, e.g. we need
to put shared X11-specific code in the base Window class or mess with
"base" classes.

As an alternative solution, this change merges the Unmanaged class into
the X11Window class and disables some functionality based on the value
of isUnmanaged().

X11Window::manage() is used to create a managed Window. X11Window::track()
is used to create an unmanaged Window.
2023-03-28 18:14:32 +00:00
Xaver Hugl
c51824b535 Add OutputManager for taking care of output settings in KWin
As a first step to move away from having an external service remember output settings
for KWin, this commit introduces an output manager that can load configuration files
and generate new output configurations.
2023-03-28 16:19:09 +02:00
Vlad Zahorodnii
e31ec802f4 Drop Deleted
Currently, the normal window lifecycle looks as follows: create Window,
wait until it's shown, add it to Workspace, wait until it's closed,
create a Deleted, copy properties from the original window to the
deleted one, destroy the original window, wait until the last deleted
window reference is dropped.

There are a couple of issues with this design: we can't nicely
encapsulate X11 or Wayland specific implementation details if they need
to be accessed for closed windows; manual copying of properties is
cumbersome and error prone and we've had a dozen of cases where effects
worked incorrectly because some properties had not been copied.

The goal of this patch is to drop Deleted and extend the lifetime of the
original window, but with a special state set: Window::isDeleted().

The main danger is that somebody can try to do something with deleted
windows that they should not do, but on the other hand, such code needs
to be guarded with relevant checks too.
2023-03-28 08:31:08 +00:00
Vlad Zahorodnii
1f43605329 Drop Workspace::clientList() 2023-03-24 22:28:46 +00:00
Vlad Zahorodnii
1b5d2e9998 Drop Workspace::internalWindows() 2023-03-21 17:01:20 +00:00
Vlad Zahorodnii
1f24b0f7cb Drop Workspace::unmanagedList()
It reduces the number of window lists to make the api of the workspace
cleaner.
2023-03-21 07:49:38 +00:00
Vlad Zahorodnii
bcc299c3fe Drop unused Workspace::deletedList()
It's unused, and there should not be any usecases for it outside the
Workspace.
2023-03-15 14:10:44 +02:00
Vlad Zahorodnii
8f21d444c6 Make Workspace::allClientList() return all windows
Currently windows are scattered in a few separate lists. If you need to
go through the windows, you have to do it piece by piece. On the other
hand, with the overhaul of window types, we've started converging
towards one universal type: Window. Keeping windows in the separate
buckets goes against this design.

Workspace::stackingOrder() already contains all windows. This change
repurposes Workspace::allClientList() from a list of "normal" windows to
all windows, i.e. Workspace::windows(), to be consistent.

There's one API change though. Scripting API will expose other window
types too. This is an intentional change so scripted effects could
operate with all windows. It also matches the current behavior observed
in libkwineffects, which exposes all windows as well.
2023-03-15 11:52:01 +00:00
Vlad Zahorodnii
2f56cdc3fe Replace Deleted with Window where possible
With this, Window and Deleted can be interchanged, which makes merging
the two easier.
2023-03-13 14:41:44 +02:00
Vlad Zahorodnii
3bec3abb3f Use "window" instead of "toplevel" in Workspace 2023-03-13 10:37:01 +00:00
Vlad Zahorodnii
5b18cba3a0 Drop Workspace::{findAbstractClient,forEachAbstractClient} 2023-03-13 10:37:01 +00:00
Vlad Zahorodnii
d79a4a1daa Make VirtualDesktopManager::currentChanged pass VirtualDesktop
It fixes the remaining usage of int desktop ids in Workspace, ignoring
Workspace::setInitialDesktop().
2023-02-25 21:22:40 +00:00
Vlad Zahorodnii
03e098204f Port Workspace::sendWindowToDesktop to VirtualDesktop 2023-02-24 10:32:41 +02:00
Vlad Zahorodnii
b53621136d Drop Window::desktopPresenceChanged()
This signal exists as a convenience helper, but it's not always emitted
as it's advertised to work. Instead of fixing it, let's drop the signal
to simplify virtual desktop code. Its effects can be accomplished by
monitoring Window::desktopChanged() and VirtualDesktopManager::currentChanged()
signals in effects and scripts where needed.
2023-02-23 22:10:37 +00:00
Vlad Zahorodnii
452bb20741 Drop Workspace::{oldDisplayWidth,oldDisplayHeight}
They're unused.
2023-02-07 21:34:07 +00:00
Xaver Hugl
6e13e21a08 workspace: take touch and tablet into account for active output follows mouse
While not technically fitting for the name of the option, the behavior is what a user
would expect and it also matches with X11 (where the cursor goes to the touch position).
2023-01-03 20:01:11 +00:00
Xaver Hugl
3204d6ac3c port all headers to pragma once 2022-12-16 20:58:17 +00:00
Xaver Hugl
0efb8d01db wayland: implement output order interface
Only thing missing is the kscreen integration bit, but that can't be done before kscreen actually stores the output order somewhere.

Depends on https://invent.kde.org/libraries/plasma-wayland-protocols/-/merge_requests/52
2022-12-15 10:08:36 +00:00
Natalie Clarius
0053c782a1 quick tiling: find target output by direction 2022-12-08 18:59:44 +00:00
Natalie Clarius
67c558286f useractions: add shortcuts for {switch to/window to} screen {direction}
BUG: 453038
2022-12-08 18:59:44 +00:00
Natalie Clarius
084b88522c workspace: get output in direction relative from reference
BUG: 451286
BUG: 453038
2022-12-08 18:59:44 +00:00
Marco Martin
e4507861f7 Custom quick tiling with configuration ui
* Allow to do quick tiling to custom tile geometries, windows will be snapped to tiles when dragged with the shift modifier pressed.
* Tile geometries are screen specific.
* The global shortcut Meta+T will trigger a fullscreen configuration ui as a QML effect for the tiles which allows to add, remove and resize tiles
* UI and behavior is a bit similar to the Windows Fancy Zones addon: https://docs.microsoft.com/en-us/windows/powertoys/fancyzones
* Its main scope is to help the workflow with very big monitors, especially ultra wide ones, where most application don't make sense maximized to the full screen (eventually also support games to be full screened to a given tile instead of the whole screen)
* it should get also some bindings for scripting, as its ain goal is not to replicate other popular tiling window managers, but should give the popular kwin tiling scripts to have a more robust infrastructure
* it will eventually get support for a set of predefined layouts, but this is for a second phase

BUG: 438788
2022-12-01 14:39:22 +00:00
Vlad Zahorodnii
b830d408af core: Rename Platform to OutputBackend 2022-11-10 10:10:28 +02:00
Vlad Zahorodnii
d257da0a00 Use StrutRects to represent restricted areas
This saves us some StrutRects -> QRegion conversions and it might be
useful for floating point struts.
2022-11-03 13:53:41 +00:00
Vlad Zahorodnii
187f556f85 Drop Screens 2022-10-19 13:29:39 +00:00
Vlad Zahorodnii
4f795dee20 Make "switch to screen" and "window to screen" code less error-prone 2022-10-13 10:43:14 +00:00
Vlad Zahorodnii
bcd43ff44d backends/x11: Implement own keyboard interception
At the moment, the keyboard interception code in the effects system
relies on Qt code processing key events. However, since QDesktopWidget
is removed in Qt 6, this is a blocker for Qt 6 port.

This change ports the X11 backend to private xkb keymap as indicates in
the todo comment. It allows us to drop the last QDesktopWidget usage.
2022-10-10 09:16:50 +00:00
Marco Martin
e853f5fe07 Don't check for workspace->initializing()
the existence of Window is bound to the one of workspace so it
will always be there.
We also need to check the window sizes before workspace is done
initializing,
otherwise when KWin restarts and there are maximized windows, they won't
be resized to take panels into account and will always span the full
screen.
2022-09-16 09:57:07 +00:00
Vlad Zahorodnii
d1de19e212 Make Workspace process batched output updates
Currently the Workspace processes output updates as they occur, e.g.
when the drm backend scans connectors, the Workspace will handle
hotplugged outputs one by one or if an output configuration changes the
mode of several outputs, the workspace will process output layout
updates one by one instead of handling it in one pass. The main reason
for the current behavior is simplicity.

However, that can create issues because it's possible that the output
layout will be temporarily in degenerate state and features such as
sticking windows to their outputs will be broken.

In order to fix that, this change makes the Workspace process batched
output updates. There are several challenges - disconnected outputs have
to be alive when the outputsQueried signal is emitted, the workspace
needs to determine what outputs have been added or removed on its own.
2022-09-12 08:03:48 +00:00
Vlad Zahorodnii
d8ea87a9ea Add dummy placeholder output type
Placeholder outputs are not rendered so they don't need render data.
Also, this simplifies the control flow when the last real output is
removed. The Platform::screensQueried signal won't be emitted inside a
Platform::screensQueried slot.
2022-09-06 10:36:33 +00:00
Vlad Zahorodnii
e97e520175 Move placement policy enum in KWin namespace
Other policy enums are declared in options.h so let's do the same for
placement policy. Besides consistency, another advantage of moving the
enum in kwin namespace is that the enum could be forward declared.
2022-09-05 14:11:42 +00:00
Xaver Hugl
ba0799974e workspace: restore window position after output changes
BUG: 455066
BUG: 374908
CCBUG: 444082
CCBUG: 454003
CCBUG: 453589
2022-08-31 22:30:13 +02:00
Xaver Hugl
a1ed313a42 backends/drm: move placeholder output management to Workspace
Backends aren't the right layer to take care of placeholder outputs, and
don't really have enough information to do it either. This also fixes a
crash, because the placeholder output currently gets created too late
2022-08-27 20:30:27 +02:00
Vlad Zahorodnii
f956d701c4 Port Workspace to Platform::{outputAdded,outputDisabled} signals 2022-08-25 06:35:55 +00:00
Vlad Zahorodnii
b0340dc774 Move primary output to Workspace
Primary output is a window management abstraction, not a hardware
abstraction so move it in Workspace where it belongs.
2022-08-25 06:35:55 +00:00
Vlad Zahorodnii
b5a4c08231 Move kscreen integration in Workspace
The main motivation behind moving kscreen integration to the
Workspace is to make output configuration work the same way
regardless of the backend and simplify the drm backend.
2022-08-18 10:20:53 +00:00
Xaver Hugl
8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2022-08-04 12:30:09 +00:00
Xaver Hugl
497a78b7cf tabbox: move global to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
43b78e40d8 screens: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
9439e7719d screenedge: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
719147952d rulebook: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
0d704b8913 placement: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
3c56bd9723 refactor Outline and move its singleton into Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
b6cf576efa move DecorationBridge singleton into Workspace 2022-07-21 15:24:57 +02:00
Xaver Hugl
7f1923cc9b move ApplicationMenu singleton into Workspace 2022-07-21 15:24:57 +02:00
Xaver Hugl
1cf2205283 move Activities singleton into Workspace 2022-07-21 15:24:51 +02:00
Xaver Hugl
1ce7dc9e02 move FocusChain singleton into Workspace 2022-07-21 15:16:40 +02:00