Commit graph

20208 commits

Author SHA1 Message Date
Vlad Zahorodnii
7d692fd2a4 plugins/idletime: Remove m_started boolean flag 2021-10-19 09:55:22 +00:00
Vlad Zahorodnii
a3de9bc93b kcmkwin: Load builtin effects from metadata files
Linking builtin effects against KCMs is really awkward. This change
decouples builtin effects from KCMs that use EffectsModel.

In order to discover builtin effects, metadata files are installed in
kwin's data dir, which will be subsequently read by EffectsModel.
2021-10-19 09:12:15 +00:00
Vlad Zahorodnii
141947d2e8 effects: Link builtin effects with executables
The main motivation behind this change is to prepare kwin for importing
kwayland-server code in libkwin.

As is, builtin effects are linked with libkwin. Some builtin effects
have wayland specific code. If we move wayland stuff in libkwin, there's
going to be a circular dependency between kwin4_effect_builtins and
libkwin targets.

This change intends to break that dependency by linking builtin effects
to kwin executable.

The main issue with that is that EffectLoader would need to discover the
effects indirectly. QStaticPlugin is used for that purpose.

Besides breaking the cyclic dependency, it makes builtin effects use the
same plugin infrastructure in libkwineffects that external effects use.

Metadata in src/effects/effect_builtins.cpp was converted in a list of
python dictionaries, which was fed to a python script that generated
main.cpp and metadata.json files.
2021-10-19 09:12:15 +00:00
Vlad Zahorodnii
2019dcd0fe Add support for static effect plugins
With static effect plugins, builtin effects can be linked to
executables. It also makes libkwin one step closer to being more
reusable.
2021-10-19 09:12:15 +00:00
Xaver Hugl
1763139834 platforms/drm: fix disabled outputs with legacy drivers
m_primaryBuffer could be nullptr when a pipeline was inactive before, causing
a crash
2021-10-19 07:37:50 +00:00
Ömer Fadıl USTA
3ec6dab5d0 Add other missing includes to fix bsd build 2021-10-19 06:18:27 +03:00
Ömer Fadıl USTA
a2a012be26 Add missing include to fix bsd compile problems 2021-10-19 06:03:49 +03:00
l10n daemon script
d154da1e0b 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"
2021-10-19 01:17:26 +00:00
Xaver Hugl
fbb5c95cc4 platforms/drm: tie primary planes to crtcs 2021-10-18 20:05:34 +00:00
Xaver Hugl
3a9491ca6d platforms/drm: Move legacy cursor handling into DrmCrtc
Makes things easier for tiling and reduces the complexity of DrmPipeline
2021-10-18 20:05:34 +00:00
Xaver Hugl
a70321c592 platforms/drm: split DrmObject::Property out in its own files 2021-10-18 20:05:34 +00:00
Xaver Hugl
307b5ce3ca platforms/drm: prettify some headers
Makes them much more readable
2021-10-18 20:05:34 +00:00
Xaver Hugl
72af309317 platforms/drm: reverse output creation order
This was inverted from 5.22, which switches plasma layouts and the default
Xwayland primary screen.
2021-10-18 19:32:59 +00:00
Vlad Zahorodnii
4dafacc00b kwineffects: Stop linking kwayland-server
As is, libkwineffects doesn't use any specific apis in kwayland-server,
it simply "forwards" wayland display and surfaces from libkwin. Given
that, there is no need to link libkwineffects with kwayland-server. If
an effect needs to access wayland specific stuff, it can link explicitly
against kwayland-server.

The main motivation behind this change is to further loosen up
dependencies between various kwin components and kwayland-server so the
latter can be moved back to kwin.
2021-10-18 16:03:30 +00:00
Aleix Pol
a9ccfba768 Fix inputmethodtest
We needed to simulate a touch event so that it doesn't decide to ignore
the next events.
2021-10-18 15:55:39 +00:00
Vlad Zahorodnii
a5a2deef60 kwineffects: Remove effectively unused surface_interface.h include
SurfaceInterface can be an opaque pointer.
2021-10-18 11:34:15 +00:00
Vlad Zahorodnii
85f8a53360 x11: Properly unredirect windows if compositing is not possible
Before attempting to create scenes, kwin will redirect windows but if
the opengl scene can't be created, it won't unredirect windows, which
seems to cause issues on aarch64.

BUG: 443953
2021-10-18 13:20:35 +03:00
Vlad Zahorodnii
dda0c24187 wayland: Remove absolute position from processMotion() that handles relative moves
API-wise it's odd to require absolute position with relative pointer
moves.

This cleans up some of InputRedirection code by making it simply forward
pointer input events from input devices to the pointer input device
handler, which knows better what to do with the delta value.

The pointer input device handler will compute the absolute position based
on the specified delta value, but it could also do something else, e.g.
not move the pointer at all if it's locked, etc.
2021-10-18 08:47:21 +00:00
Alexander Lohnau
8adfd2f244 Use enum value for KAuthorized::authorize
Task: https://phabricator.kde.org/T11948
2021-10-18 07:03:50 +00:00
Vlad Zahorodnii
6d5fc9fd30 Restore old behavior of Workspace::clientArea(clientOpt, Toplevel)
When geometry updates are blocked, the output doesn't get updated. This
breaks Workspace::clientArea() overload that takes only the window.

Previously, clientArea() would look up the output where the window is
every time it's called, so the fact that the screen id or AbstractOutput
is unsynchronized with the frame geometry was irrelevant.

This change restores the old behavior as 5.23 is affected by the
output() being out of sync with the frameGeometry(). Specifically, when
kwin starts managing an X11 window, it will block geometry updates,
setup the window, e.g. make it fullscreen, and unblock geometry updates.

Since Workspace::clientArea(clientArea, Toplevel) uses the output(),
X11Client::setFullScreen() will most likely put the X11 window at a
wrong output if it's called inside X11Client::manage().

BUG: 443787
2021-10-18 05:25:06 +00:00
Vlad Zahorodnii
23e5039918 Fix build on Gentoo
AbstractEglBackend includes option.h, which includes main.h, which
includes QApplication. Since SceneOpenGLBackend doesn't link against
Qt::Widgets, kwin fails to build on Gentoo, but not on other distros
for some reason...
2021-10-17 15:49:57 +00:00
Aleix Pol
ff618e9f41 Do not ask for decoration settings without guarding
Otherwise we crash when no decoration is set (e.g. Plasma Mobile)
2021-10-17 14:41:34 +00:00
ivan tkachenko
aaa060d6c1 KCM: Implement better layout
Text labels without extra margins on the left looked mis-positioned.
2021-10-16 03:27:08 +00:00
Rodney Dawes
518c75a042 InputMethod: Use new API to pass modifiers map along to clients 2021-10-15 16:47:06 -04:00
Rodney Dawes
9818f4a4e5 InputMethod: Update for kwayland-server API change with keysym events
To avoid needless conversion of modifiers in kwayland-server, we needed
to break API so that the modifiers are simply passed through.
2021-10-15 16:47:06 -04:00
Vlad Zahorodnii
cc98001d4c Use move resize geometry in AbstractClient::applyWindowRules()
Abstract clients tolerate passing the shaded window geometry to
moveResize().

But the main issue with applyWindowRules() is that it uses the current
frame geometry even though it calls moveResize(). It's not a big deal
but it's error prone.

This change ports applyWindowRules() to the move resize geometry, which
makes code more straightforward and ensures that kwin uses right
geometry type with moveResize().
2021-10-15 20:19:20 +03:00
Vlad Zahorodnii
368bbde1ff Make geometry updates blocker pass last move resize geometry
X11Client tolerates passing shaded geometry to moveResize() and in many
cases kwin already does that.

Another issue is that this doesn't align well with new async geometry
handling abstractions. pos() can't be used because it corresponds to the
current frame position.

We can safely pass the last move resize geometry. It simplifies code a
bit and makes sure that everything works as expected with the move
resize geometry.
2021-10-15 20:18:59 +03:00
Vlad Zahorodnii
b90975b7a2 Replace AbstractClient::adjustedSize() with a simpler alternative
Currently, adjustedSize() does two things - it computes and constrains
the natural size of the window.

In many places where adjustedSize() is used, the natural size doesn't
need to be constrained and in some it's actually undesired because
AbstractClient::constrainClientSize() doesn't allow the client size to
be 0x0, which can happen when dealing with a client that has no buffer
committed yet.

This change replaces adjustedSize() with implicitSize(), which simply
calculates the natural frame size based on the current client size.

If the frame size needs to be constrained, for example during
interactive move-resize, use constrainFrameSize() or if you need to
constrain the client size - constrainClientSize().
2021-10-15 17:16:11 +00:00
Vlad Zahorodnii
a195290600 Simplify AbstractClient::applyWindowRules()
Trying to reconstrain the geometry after applying rules is unnecessary
because if the geometry is forced using a rule, resizeWithChecks()
should not change it; if the window is maximized or has entered fullscreen
mode, window gravity is irrelevant. If the window is shaded, this
resizeWithChecks() is not needed.

This change simplifies AbstractClient::applyWindowRules(), which allows
to split adjustedSize() to further simplify geometry handling.
2021-10-15 17:16:11 +00:00
Aleix Pol
3e77907d21 inputmethod: Use touch events to decide if the panel is shown not the state
Prefer hiding/showing the panel (i.e. the window) when not a touch event
than stopping to make the inputmethod active.
This way we remain compatible with non-virtualkeyboard inputmethods.
2021-10-15 15:41:35 +00:00
Xaver Hugl
5b9deafa14 InputMethod: only activate virtual keyboard when used with touch 2021-10-15 15:41:35 +00:00
Vlad Zahorodnii
f1e99e971f scripting: Guard against nullptr m_client in WindowThumbnailItem
BUG: 443765
2021-10-15 07:59:55 +00:00
Vlad Zahorodnii
59a4a908f9 Properly update parent item's bounding rect when moving item
The bounding rect of an item is in the item-local coordinate space. If
the item is moved, its bounding rect won't change, but the parent's
bounding rect, may change.

BUG: 443756
2021-10-15 10:30:49 +03:00
Vlad Zahorodnii
ff3465a80e Fix AbstractClient::adjustedSize() for wayland windows with no committed buffer
AbstractClient::constrainClientSize() forces the minimum client size of
1x1.

If AbstractClient::adjustedSize() is called before the XdgToplevelClient
is mapped, it will return 1x1 rather than 0x0 as expected, which will
confuse

    QSize s = adjustedSize();
    if (s != size() && s.isValid())
        resizeWithChecks(s);

in AbstractClient::applyWindowRules(). Since 1x1 is different from 0x0,
the xdg-toplevel surface is going to be resized to 1x1.

BUG: 443705
2021-10-15 05:38:54 +00:00
Vlad Zahorodnii
d4dd370cf3 autotests: Fix ASAN issues
Currently, InputRedirection is not destroyed before waylandServer(),
unlike in kwin_wayland, which causes some null dereferencing.
2021-10-14 22:03:39 +03:00
Vlad Zahorodnii
b4a4e8a45d Drop WaylandServer::terminateClientConnections()
Display will destroy all client connections before getting destroyed.
2021-10-14 10:02:50 +00:00
Vlad Zahorodnii
e550480c43 Rework input method teardown logic
Explicitly destroy input method rather than wait for the input method
connection to be destroyed by WaylandServer, it's less error prone.

BUG: 443603
2021-10-14 10:02:50 +00:00
Vlad Zahorodnii
4f46da46fc wayland: Move relative pointer extension instantiation to WaylandServer
Whether relative pointers are supported doesn't depend on the input
backend. This change moves the instantiation of the extension to the
WaylandServer class to make code more consistent.
2021-10-14 06:41:01 +00:00
Aleix Pol
3da0725404 Fix build
We forgot to remove the subdirectory when moving builtin plugins into
separate targets.
2021-10-14 02:44:29 +02:00
Vlad Zahorodnii
6b015d1e6e libinput: Drop mm position in Connection::pointerMotionAbsolute()
The position in millimeters is unused and it can't be applied to virtual
input devices.
2021-10-13 20:52:45 +03:00
Vlad Zahorodnii
bf620fbe04 Move Xkb::LEDs enum to KWin namespace
With the LEDs enum being defined in kwinglobals.h, wayland_server.h
won't need to include keyboard_input.h, which is good for compilation
times and wayland_server.h will drag less stuff, e.g. QtWidgets (input.h
includes QAction)
2021-10-13 17:49:19 +00:00
Vlad Zahorodnii
9cdd363fa1 effects: Pass full name to kwin4_add_effect
This way, it's more clear what target name is.
2021-10-13 17:05:06 +00:00
Vlad Zahorodnii
10b56bd43d effects: Modularize builtin effects build
Currently, cpp source files are included partially in effect sub-folders
and src/effects/CMakeLists.txt, which is really confusing and hard to
follow.

With this change, effect targets will be defined in their own subfolders.
This makes build files more straightforward.

Effect sub-targets are eventually merged into a monolithic
kwin4_effect_builtins target.

Another reason for modularizing builtin effects is that no two effects
can generate moc files with the same name atm even though they are in
different sub-folders. This can be potentially useful in the future, e.g.
making effects static plugins in order to decouple builtin effects from
libkwin (every effect subfolder would need a main.cpp or plugin.cpp file,
which will include the associated moc file).
2021-10-13 17:05:06 +00:00
Vlad Zahorodnii
ec6e6fa63c effects/showfps: Add destructor
The GLTexture class is forward declared and the ShowFpsEffect class has
a QScopedPointer<GLTexture> field. We either need to include the
kwinglutils.h header file or add a destructor that does nothing and
define it in the cpp file, where kwinglutils.h is included.
2021-10-13 17:05:06 +00:00
Aleix Pol
c07182490d pipewire: Fix downloading software-rotated textures
At the moment we'll be setting the YInverted setting, but in practice
that won't have any effect as it only changes the render matrix and
we'll end up streaming inverted textures.
This change addresses it by rendering it into another texture first to
resolve this situation and then download that new texture instead.
2021-10-13 17:16:15 +02:00
Aleix Pol
67ec16c335 pipewire: No need to create a QRect when we just need its size 2021-10-13 17:14:53 +02:00
Nate Graham
c1fb405b8d Rename "pack" actions for clarity
The English word "pack" is not really the correct word for these
actions, and does not succeed in communicating what they will do. Since
the actions simply move the active window as far as it will go in the
specified direction, the actions can be renamed to say that instead.

Also rename the action names in the code to match their new UI text for
clarity.
2021-10-13 14:28:23 +00:00
Méven Car
cc5b47ee30 abstract_client: convert some Q_FOREACH 2021-10-13 15:44:39 +02:00
Andrey Butirsky
59143eeef9 [wayland] fix crash on startup with lv3:ralt_alt XKB option
With lv3:ralt_alt ("Right Alt never chooses 3rd level") option set, we
get more layouts from libxkbcommon than it was configured, see:
https://github.com/xkbcommon/libxkbcommon/issues/262
It might be correct lib's behavior, still.

The extra layouts are redundant, so we strip them out from usual usage.

BUG: 440027
2021-10-12 15:41:54 +00:00
Vlad Zahorodnii
e29997bda8 plugins/nightcolor: Remove unused options 2021-10-12 06:38:23 +00:00