Commit graph

22926 commits

Author SHA1 Message Date
Vlad Zahorodnii
2629007eef Make outputs disabled by default
This can be used to make our backends more multi-purpose. At the moment,
new outputs are enabled by default, but it makes sense to do otherwise.

For example, if an output is disabled by default, it would be possible
to delegate initial output configuration to layer above, to kwin.

In long term, the drm backend would need to scan connectors, create an
Output for every one of them, kwin sees new outputs and tries to apply
the initial output configuration, which includes the enabled status.
2022-07-27 09:22:10 +00:00
ivan tkachenko
854aebb3ae
Mark window type properties as CONSTANT
Since we don't have any means of getting notified by _NET_WM when a
windowType changes, and since KWin would handle that quite poorly, AND
since no one does that in real-world applications anyway, we might as
well mark those getters as CONSTANT, so that QML engine would stop
complaining about depending on non-NOTIFYable properties.

According to the specification, the window type should be decided before
a window gets mapped.
2022-07-27 12:06:54 +03:00
David Edmundson
2073415f91 Ensure size is valid after maximising
In X11 when a window is maximised if the client is unable to fufill the
space provided we centre align the window.

With the new floating point geometry behaviour of centreing changes.
Instead of a 1 pixel gap at the top, we get a 0.5 pixel gap either side.
When we get into the codepath to "fix" the window in `closeHeight` we
only move the top, giving us an invalid buffer size.

We don't really want to change the logic here; on xwayland with the
scaling opt-out path it's feasible for a floating sized logical size to
still be representable. This code rounds to the native unit after all
the logic has taken effect.
2022-07-27 08:43:23 +00:00
Alexey Andreev
c61515cd8d kwinglutils: restore alignment logic for Mali GPU
Contributes to:

https://invent.kde.org/teams/plasma-mobile/issues/-/issues/172
2022-07-27 08:20:40 +00:00
Vlad Zahorodnii
3ce24a0cbf Make OutputConfiguration take OutputMode
OutputMode provides a more robust way to refer to outputs. A mode can
have flags and things as such that are not taken into account with mode
+ refresh rate.
2022-07-27 07:26:48 +00:00
Vlad Zahorodnii
726f97d2a6 effects/slidingpopups: Fix slide offset
Code such as "screenRect.bottom() - windowGeo.bottom()" assumes that
both screenRect and windowGeo have the same type. At the moment, it's
not the case, screenRect has QRect type and windowGeo has QRectF type,
so the calculated offset will be off by one.
2022-07-27 07:09:14 +00:00
Xaver Hugl
5e602434c0 backends/drm: fix memory leak 2022-07-26 19:41:51 +00:00
Xaver Hugl
4be81e0176 backends/drm: make modeset tests explicit
Instead of checking for properties needing a modeset, do atomic tests
with ALLOW_MODESET where it makes sense, and do a second atomic test
afterwards without ALLOW_MODESET to check if the modeset can be skipped.

This should ensure that KWin always does a modeset when it needs to do one,
 and not do a modeset when it's not necessary. Doing this also allows
reducing the complexity of the drm backend a bit.
2022-07-26 19:03:33 +00:00
Alexander Lohnau
bd8d65a861 Port deprecated KPluginMetaData constructor for json file 2022-07-26 15:28:08 +00:00
Vlad Zahorodnii
71a58231e8 backends/drm: Make DrmOutput::queueChanges() not touch active status
The DrmOutput synchronizes the enabled state with the active state,
which makes sense on one hand, but on the other hand, that's not good.
The drm backend makes a decision that should be ideally made by either
kscreen (turn on outputs before applying an output config), user, or
kwin itself.

This would also allow kwin to control the allocation of crtcs for
non-desktop outputs, which is a minor thing, but it might be useful in
the future.
2022-07-26 13:40:29 +00:00
David Redondo
0fc4bf7fba Remove another unneded include
GIT_SILENT
BUG:457152
2022-07-26 13:32:27 +02:00
David Redondo
1f9c317878 Remove unneeded include
BUG:457152
2022-07-26 10:06:14 +00:00
Xaver Hugl
361fc0a38e backends/drm: remove drm lease layers
They just add more code and more potential problems, and the difference in
VRAM usage is very minimal
2022-07-26 09:57:06 +02:00
Xaver Hugl
b7d7a99fcb backends/drm: fix placeholder output check
Non-desktop outputs must be ignored
2022-07-26 07:06:30 +00:00
David Edmundson
e67e9b6e28 Avoid rounding in frameSizeToClientSize 2022-07-26 06:20:24 +00:00
David Edmundson
4573337bfe Avoid unneeded Rect conversion 2022-07-26 06:20:24 +00:00
Aleix Pol
27f24d1449 input: Introduce a outputArea property for tablet devices
It's important for tablet devices to be able to specify to which section
of the display we'll be fitting the tablet. This setting allows to
specify this by providing some options that will do so relative to the
output size.

CCBUG: 433045
2022-07-25 23:29:07 +00:00
Niklas Stephanblome
8407f88585 effects/overview: Add window filtering
This adds window filtering to the Overview effect. This satisfies both
Overview users' needs and the workflow of Windowview: When the user
starts typing, windows are filtered by default. If there is no matching
window, then the Milou UI is shown, including the option for opening a
new app is shown--the same one that currently gets shown when the user
starts typing. This leads to a very seamless experience, where the user
can type any app name and they will get it, no matter if it's already
opened or not.
2022-07-25 16:18:06 +00:00
Vlad Zahorodnii
dc92939908 Adjust Window code to behavior of QRectF::right() and QRectF::bottom() 2022-07-25 10:49:14 +00:00
Vlad Zahorodnii
519a2db950 Remove leftover qDebug()s 2022-07-25 09:19:44 +00:00
Vlad Zahorodnii
1b4258bf17 kwineffects: Move infiniteRegion() to kwinglobals.h
infiniteRegion() is useful not only to effects but also other kwin
components, so move it to kwinglobals.h in order to make backends stop
depending on libkwineffects
2022-07-25 10:52:03 +03:00
Vlad Zahorodnii
1baf39daf7 backends/drm: Improve device seat assignment handling
This fixes the drm backend adding hotplugged gpus that belong to other
seats and makes the udev helper depend on less stuff from the layer
above backends.
2022-07-24 19:36:50 +03:00
Vlad Zahorodnii
cf3fe003e6 Move ownership of Session to Application
The Session can be useful not only to the platform backend but also
input backends and for things such as vt switching, etc. Therefore it's
better to have the Application own the Session.
2022-07-24 19:14:26 +03:00
Vlad Zahorodnii
5e669aece9 backends/libinput: Take Session explicitly
The API will be more clear about what the libinput backend needs.
2022-07-24 19:14:26 +03:00
Alexander Lohnau
4f7b2054e1 Remove "KCModule" ServiceType for KCMs
This is not needed anymore.

Task: https://phabricator.kde.org/T14483
2022-07-24 15:52:12 +00:00
Alexander Lohnau
ce694e838f De-duplicate json metadata of KPackages
Systemsettings and Plasma-Settings use the embedded json metadata instead of the KPackage one

Task: https://phabricator.kde.org/T14983
2022-07-24 15:52:12 +00:00
Alexander Lohnau
1a38ea6aba Port to KCM desktop file generation method from kcmutils
This de-duplicates the translations needed for the KCMs.

Task: https://phabricator.kde.org/T15609
2022-07-24 15:52:12 +00:00
Vlad Zahorodnii
36e238cda5 backends/drm: Remove EdidOverwrite config option
This is a too niche feature. It also doesn't have to be implemented in
the compositor. The kernel provides a way to overwrite the edid blob,
which is not specific to the running compositor.
2022-07-24 15:37:44 +00:00
Vlad Zahorodnii
96f3a5eec2 backends/drm: Fix dangling connectors in m_allObjects
We add connectors to m_allObjects but never remove them.

CCBUG: 457002
2022-07-24 14:20:12 +00:00
Vlad Zahorodnii
5aef41663a backends/drm: Fix potential use-after-free
When the output is removed, there are legit cases when the connector can
be still accessed.

CCBUG: 457002
2022-07-24 14:20:12 +00:00
Xaver Hugl
f0d59b078b backends/drm: explicitly initialize all fields of drmModeModeInfo 2022-07-24 13:49:54 +00:00
Xaver Hugl
bf6990da45 backends/x11/windowed: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Xaver Hugl
2420949628 backends/x11/common: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Xaver Hugl
ff0e89b030 backends/x11/standalone: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Xaver Hugl
d251d33402 backends/drm: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Xaver Hugl
24b1eab228 backends/wayland: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Xaver Hugl
9d3561faf8 backends/virtual: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Vlad Zahorodnii
50e99808e8 utils/udev: Drop Udev::listFramebuffers()
The fbdev backend was dropped so it's unused.
2022-07-24 09:23:35 +00:00
Xaver Hugl
6d1c97c4bc workspace: fix resize snapping
With the existing behavior there was a 1px gap between windows
2022-07-23 22:14:56 +00:00
Vlad Zahorodnii
045da603a4 Make backends part of libkwin
Platform backends are provided as plugins. This is great for
extensibility, but the disadvantages of this design outweigh the
benefits.

The number of backends will be limited, it's safe to say that we will
have to maintain three backends for many years to come - kms/drm,
virtual, and wayland. The plugin system adds unnecessary complexity.

Startup logic is affected too. At the moment, platform backends provide
the session object, which is awkward as it starts adding dependencies
between backends. It will be nicer if the session is created depending
on the loaded session type.

In some cases, wayland code needs to talk to the backend directly, e.g.
for drm leasing, etc. With the plugin architecture it's hard to do that.
Not impossible though, we can approach it as in Qt 6, but it's still
harder than linking the code directly.

Of course, the main disadvantage of shipping backends in a lib is that
you will need to patch kwin if you need a custom platform, however such
cases will be rare.

Despite that disadvantage, I still think that it's a step in the right
direction where the goal is to have multi-purpose backends and other
reusable components of kwin.

The legacy X11 standalone platform is linked directly to kwin_x11
executable, while the remaining backends are linked to libkwin.
2022-07-23 11:52:42 +00:00
Vlad Zahorodnii
0fbd5fa377 backends/virtual: Provide own logging.h file
target_sources() doesn't work as expected with generated source files.
2022-07-23 11:52:42 +00:00
l10n daemon script
acd5bf9a6e SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2022-07-23 01:47:37 +00:00
ivan tkachenko
df6331b60a effects/colorpicker: Fix picking colors
Due to the wrong buffer format, the function failed with
GL_INVALID_OPERATION error, which was silently ignored by the effect.
It resulted in the constant phantom color being returned over and over
again.

Co-Authored-By: David Edmundson <kde@davidedmundson.co.uk>
BUG: 454974
FIXED-IN: 5.24.7, 5.25.4, 5.26
2022-07-22 19:51:11 +00:00
Nate Graham
282e79c178 useraction: port away from DEF macros
Currently, defining shortcuts in useractions.cpp is done using one of
six macros, some of which allow the name that ends up as the key in
the config file to be autogenerated from an untranslated form of the
user-facing text.

Whenever a shortcut using one of these macros is renamed, the key in the
config file changes too, so users lose any custom shortcuts they had
assigned.

To avoid this, developers need to know that they have to switch to the
relevant macro that allows the name and description to be defined
separately, remember to do so, and manually set a name that matches the
old user-facing text. This can be forgotten, is not obvious to new
developers, and is a subtle source of user-facing bugs.

In addition the macros are largely unnecessary, as they are wrappers 
around a custom function. We can just call the custom function 
ourselves.

This commit ports away from the macros and calls the initShortcut()
instead, which resolves both issues.

cc @davidre
2022-07-22 16:50:25 +00:00
Volker Krause
9e8b370453 Adapt to Qt 6.3 API changes to QMutableEventPoint 2022-07-22 14:03:30 +00:00
Vlad Zahorodnii
1fccb3daf1 plugins/colord-integration: Expose outputs managed by Workspace
Workspace knows better about managed outputs, and it removes one more
dependency on Platform::enabledOutputs() and the corresponding signals.
2022-07-22 13:49:12 +00:00
Vlad Zahorodnii
82c1cf3de2 backends/drm: Pass DrmGpu to page flip handler through user data
The page flip handler can be simpler if it gets the gpu through user
data. It also removes a usage of the Application singleton.
2022-07-22 12:02:47 +00:00
Vlad Zahorodnii
e179d9cea1 Load plugins after Workspace is created
The original intention behind creating plugins before the workspace was
to handle the case where kwin_wayland may need to wait until outputs are
available. However, since things have changed a lot in that regard,
plugins can be loaded after the workspace now.

The main benefit behind this is that plugins can be simpler, they won't
need to track when the workspace is created.

On X11, plugins are already loaded after the workspace is instantiated.
2022-07-22 11:28:21 +00:00
Vlad Zahorodnii
211d0c00fc Remove unused main.h includes 2022-07-22 13:13:14 +03:00
Xaver Hugl
b6cf576efa move DecorationBridge singleton into Workspace 2022-07-21 15:24:57 +02:00