Commit graph

1195 commits

Author SHA1 Message Date
Aleix Pol Gonzalez
6c4ded2034 input: Allow different surfaces to be interacted in parallel by touch
While on pointers and keyboards the focus patterns follows rather
naturally, on touch screens it doesn't so much.
This change adapts our touch infrastructure to allow for multiple
surfaces to be issued touch events without forcing all interactions into
the same one.

Signed-off-by: Victoria Fischer <victoria.fischer@mercedes-benz.com>
2024-08-28 09:36:51 +00:00
Vlad Zahorodnii
4258797402 Port Workspace::cascadeOffset() away from Window::frameGeometry()
Workspace::cascadeOffset() can be called by placement code before the
frame geometry has a valid position. That is wrong. In order to avoid
that, use the placement area that we are given.
2024-08-23 09:01:56 +00:00
Xaver Hugl
d0c4aeeb08 options: enable separate screen focus by default
When the user closes the active window, with separate screen focus disabled, a
window on the other screen might get activated, which also switches the active
screen to the other one. As this is quite unintuitive, and in my testing having
separate screen focus enabled didn't have any other unintuitive side effects,
this commit enables separate screen focus by default
2024-08-23 00:33:01 +02:00
Vlad Zahorodnii
36c447a35a autotests: Add X11 stack tests 2024-08-20 12:42:49 +00:00
David Redondo
9e2326d3ac Generate wayland code with PRIVATE_CODE 2024-08-15 14:16:11 +00:00
Xaver Hugl
6b3f211ef7 wayland: remove workaround for xdg-dialog base name with wayland-protocols <= 1.35
We require 1.36 now, so the workaround is no longer necessary
2024-08-14 14:50:14 +02:00
Xaver Hugl
370c9c8953 window: make setQuickTileMode more sane
...by removing the keyboard flag, moving keyboard shortcut handling into a separate
method and making the position to tile the window at explicit

This also means KWin doesn't do as many intermediary changes to window geometry on output
hotplugs, which may work around some clients not always reacting to no-op changes.

CCBUG: 479694
2024-08-14 11:38:07 +00:00
Vlad Zahorodnii
298486d47a wayland: Pass private-code to waylandscanner
The main goal is to avoid leaking our private xyz_interface objects.
2024-08-13 19:59:11 +00:00
Xaver Hugl
2a5716e782 effects/animationeffect: port to stl containers
We need to attach non-copyable data to animations, and Qt containers don't work for that
2024-08-12 12:13:31 +00:00
Xaver Hugl
18f1092728 scene/item: add ItemEffect
Right now it's just a helper to mark items as being affected by some effect,
to prevent direct scanout of the relevant item without needing to block direct
scanout for the whole screen
2024-08-12 12:13:31 +00:00
Vlad Zahorodnii
68a621f95a utils: Rename KXcursorTheme to CursorTheme
The KXcursorTheme type no longer with Xcursor only cursors, so rename it
to maintain more reasonable naming conventions.
2024-08-07 11:57:39 +03:00
David Redondo
31018c000b wayland: Check serial instead of focus for changing selections
Clients can have valid reasons to change the selection when the
same user action that also caused the selection request
to lose keyboard focus. This is notbaly the case for menus
created from a Plasma panel which itself will not take focus
but when clicking on action it only triggers after the menu
is closed.
This also matches what weston and sway do.
BUG:490803
2024-08-06 12:54:00 +00:00
Xaver Hugl
ab8f05a57f activation: fix X11 windows being stuck in should_get_focus more properly
amends d01e20b6a9, and adds an autotest for the bug
2024-08-05 23:25:53 +02:00
Yifan Zhu
1240ac1dfe plugins/buttonrebinds: correctly handle level 1 keys
Level 1 keys (e.g., !=Shift+1) need to have shift added.

BUG: 484367
2024-08-05 16:37:32 +00:00
David Edmundson
8fd4476ff1 wayland: Move XWayland key forwarding into a filter
We optionally send some keys to xwayland through the filter when no x11
client has focus. This allows shortcut handling in X11 apps to work.

When kwin is grabbing keys we don't necessarily want X11 to sniff these
keys as things can get out of sync. A key place is the tabbox. The X11
client sill has focus, but xwayland is not active. This means we pass
tab keys to X which then go to application incorrectly.

Part of this patch changes the tabbox filter to not intercept the alt
key release event. This ensures xwayland's concept of pressed modifiers
stays in sync.

BUG: 484992
2024-08-02 09:31:40 +00:00
David Edmundson
6675eccf6d inputmethod: Send pre-defined commit message to client on user interaction
In some IM backends pre-edit text should be submitted on user interaction, in some it should be discarded. 

In TextInputV1 and V2 this was a flag sent to the client along with
the commit string ahead of time.

TextInputV3 does not have a flag for this, so we handle it compositor side.

We flush the text to be committed :
 - when we change keyboard focus, before the current client gets wl_keyboard.leave
 
 - when a mouse is pressed in the relevant surface
 
 - when a key is pressed and the InputMethod doesn't have a grab
 
 - when the InputMethod forwards a key to the client
 (which includes the InputMethod passing on grabbed keys)
2024-08-02 09:07:46 +00:00
Vlad Zahorodnii
1e9b961761 tabbox: Reset keyboard focus when grabbing input
When the tabbox grabs input, the key events won't be sent to the client.
It's not good for a couple of reasons: first, it can fool the client into
repeating a previously pressed key; and the server side and the client
side can be out of sync after the task switcher is dismissed.

In order to handle that properly, this change makes the tabbox reset the
keyboard focus when it's shown or hidden. When the task switcher is
dismissed, an enter event will be sent with the current state of the pressed
keys.

Ideally, the same needs to be done with the pointer focus but it's
challenging to achieve with the current input pipeline design. An input
grab abstraction is needed to handle pointer focus when the task switcher
is active.
2024-08-02 06:10:15 +00:00
Joshua Goins
34c2a36000 ButtonRebindsFilter: Support keyboard modifiers with mouse buttons
This is needed to better support emitting mouse button events when
pressing tablet buttons. It's common in many art programs that an action
is tied to a mouse button + a modifier, such as panning the canvas. So
being able to send keyboard modifiers in tandem with mouse buttons is
very useful when rebinding.

Tests are added for this new feature.

CCBUG: 469232
2024-07-29 15:46:44 +00:00
Nicolas Fella
e3ad1fa04f plugins/stickykeys: Disable when two keys are pressed
BUG: 464453
2024-07-25 14:22:17 +02:00
David Edmundson
374d859493 xwayland: Only update keyboard modifers for XWayland's keys
KeyboardInterface is a multiplexer, it has a global state to kwin
that forwards events the single focussed window.

XWayland also forwards events to clients, but uses the keyboard interface.
It has some overloads that take a specific client, this was used for key events
but not modifiers.

The end result was not only that XWayland could miss a modifier update, but
also that wayland clients would get modifier updates out of order.
Key events must come first.

BUG: 490270
2024-07-24 15:57:21 +00:00
Xaver Hugl
b0a8294b05 autotests: test placement to always put the titlebar on the screen
CCBUG: 489500
2024-07-23 16:16:25 +02:00
Vlad Zahorodnii
02fbeeae78 Make Workspace::desktopResized() reassign outputs of uninitialized windows
If an output is deleted, the Workspace::desktopResized() is going to
re-assign windows to the new outputs. It is done so so the workspace
re-arrangement procedure is deterministic and has concrete order.

However, with the current Window lifecycle management, it's possible
to encounter the follwing case:

- xdg_toplevel gets created on output A
- xdg_toplevel initial state is committed
- output A is removed
- a wl_buffer is attached to the xdg_toplevel, which results in a
  geometry change and an output change
- Window::setMoveResizeOutput() is called, but the previous output
  is a dangling pointer

CCBUG: 489632
2024-07-23 13:46:06 +00:00
Joshua Goins
59699402ad ButtonRebindsFilter: Set cursor position when rebinding tablet events
Since the tablet cursor and the mouse cursor is tracked separately,
rebinding a tablet button to a mouse click is sort of wonky. For
example, if you assign it to Right Click and attempt to open a context
menu it will appear to open in the wrong place.

So before we send the mouse button event, set the mouse position to
the tablet cursor position. A test is added to ensure this functionality
works as intended and doesn't regress.
2024-07-23 01:36:33 +00:00
Joshua Goins
fd670453e5 ButtonRebindsFilter: Modify testBindingTabletTool to use proximity
This is to not destroy the tablet state for the next test (which is
added in the next commit.) We could also explicitly do a tablet tool
up/down dance here, but all we need is the tablet tool to be in
proximity for the tablet button event to fire.
2024-07-23 01:36:33 +00:00
Joshua Goins
abc6dae6df ButtonsRebindFilter: Add tests for the tablet binding types
This adds autotests for binding to tablet pad and tool buttons, which
was previously untested. Of note is that we don't explicitly test mouse
buttons, which is already tested in the other functions.
2024-07-22 20:39:19 -04:00
Joshua Goins
b89f85f46d Add testing infrastructure for virtual tablet pad and tools
This is for the ButtonRebindFilter tests, but this could be useful
in other places too.
2024-07-23 00:38:36 +00:00
Joshua Goins
0ea1bcfe89 ButtonRebindsFilter: Add test for disabled bindings
This was missed when it was first implemented, but now there's tests for
checking if bindings can be disabled in the buttons rebind plugin.
2024-07-23 00:38:36 +00:00
Joshua Goins
47a538e61c ButtonRebindsFilter: Add test for mouse button binding
This was missed when it was first implemented, but now there's tests for
checking the mouse binding functionality in the buttons rebind plugin.
2024-07-23 00:38:36 +00:00
Vlad Zahorodnii
53b61ce5d7 autotests: Fix a race condition in X11WindowTest
NETWinInfo queries the window state and setState() will do nothing if the
proposed new state matches the cached server side state.

On the other hand, given how the test is structured, there can be pending
fullscreen changes on the kwin side that are yet to be sent to the X server
when the NETWinInfo object is created.

This change fixes that race condition by adding an explicit Xcb::sync().
2024-07-18 12:17:18 +00:00
Nicolas Fella
19bf66c42a plugins/stickykeys: Unlatch modifiers when locking
The state should be either latched or locked, not both
2024-07-17 13:13:40 +02:00
Nicolas Fella
85b5048e72 Test locking sticky keys for all modifiers 2024-07-17 10:58:49 +00:00
Nicolas Fella
65405c128e Release key in sticky key test
Otherwise it's pressed the whole time, breaking subsequent tests
2024-07-17 10:58:49 +00:00
Nicolas Fella
6f750f0aa5 Fix typo in comments 2024-07-16 16:08:14 +02:00
Vlad Zahorodnii
7575de4b02 Port Window::updateInteractiveMoveResize() away from input()->keyboardModifiers()
Since 12c12b3af1, input()->keyboardModifiers()
doesn't work on X. Modifiers need to be pulled from input events.
2024-07-15 15:08:11 +00:00
Vlad Zahorodnii
09e0345ccc wayland: Dismiss XdgPopupWindow when the parent window is closed
XdgPopupWindow can't exist on its own.

BUG: 472013
2024-07-15 07:41:43 +00:00
Xaver Hugl
de8bd8f126 plugins/fadingpopups: don't block direct scanout
The effect only modifies the opacity of individual windows that
WorkspaceScene::scanoutCandidate will reject anyways, so there's no reason
for it to block direct scanout.
Once a more proper solution for blocking direct scanout on individual items
is in place, this can be removed again

BUG: 487780
2024-07-11 16:54:25 +02:00
Vlad Zahorodnii
abd790c4b5 autotests: Skip testScreencasting in CI
pipewire 1.2 has a known regression where the client's process callback
will not be triggered if the producer has sent only one buffer.

The issue has already been fixed upstream
525360d70a

Until our CI picks up that change, temporarily disable the test to unblock
merging patches.
2024-07-11 09:34:34 +00:00
Nicolas Fella
e14e4a1f8e Fix comment in test
The intent is that the key is *not* locked
2024-07-10 09:35:31 +00:00
Nicolas Fella
463d77ec18 Fix sticky keys for AltGr
We map AltGr to Qt::GroupSwitchModifier, but then ignore it

Instead map it to Mod5, which for some reason xkbcommon doesn't expose a define for

Also, since the Qt modifiers enum doesn't map nicely to XKB modifiers introduce our own enum to avoid confusion

CCBUG: 444335
2024-07-10 09:35:31 +00:00
Vlad Zahorodnii
9ae6ca3481 autotests: Force breeze_cursors cursor theme
Distros like Fedora don't ship Vanilla-DMZ cursor theme.
2024-07-09 17:51:07 +00:00
Vlad Zahorodnii
3492f52179 autotests: Fix cursor shape in PointerInputTest::testMoveCursor()
The cursor during interactive move had been changed to the "grabbing"
cursor shape in d7772031b1.
2024-07-09 17:51:07 +00:00
Alik Aslanyan
3b34e9309b tiling: Don't put maximized windows in tile
After !5532 existing behavior in public scripting API was changed for maximized Windows.
Maximized Windows didn't have a tile on purpose.
This behaviour was changed, as after refactoring separate members for storing QuickTileMode in Window and tile itself were unified
Previously QuickTileMode::Maximize was only set in the Window itself in m_quickTileMode, while tile itself was removed (by setTile(nullptr)).

Current QuickTileMod for current Window isn't part of public scripting API, so it's okay to break it.

This restores compatability with scripts created for KWin 6.0.5 and earlier

BUG: 489463

Signed-off-by: Alik Aslanyan <inline0@pm.me>
2024-07-09 17:24:15 +00:00
Vlad Zahorodnii
d2df8ea9aa autotests: Make testTranslucency less flaky
There's a race condition between the window becoming ready for painting
and testing the translucency animation.
2024-07-09 11:36:10 +03:00
Vlad Zahorodnii
944be3d55a Drop WaylandServer initialization flags
These flags affect kwin in general so WaylandServer is not the best place
for them to live in. For such things, we typically add properties in the
Application object, which is what this change does.
2024-06-23 17:53:17 +00:00
Xaver Hugl
e16069ae77 autotests: add Xwayland scale changes to the output changes test
CCBUG: 487409
2024-06-17 20:41:58 +02:00
Marius P
ba599a2aa0 Prefer en_US, "centre" -> "center" 2024-06-17 05:29:59 +00:00
Xaver Hugl
bffae41983 remove Workspace::sendWindowToOutput
It just calls Window::sendToOutput...

BUG: 329980
2024-06-07 00:44:24 +00:00
Vlad Zahorodnii
d048f9aad8 autotests: Destroy WaylandServer before Application 2024-06-03 11:22:13 +00:00
Yifan Zhu
09d4f3fda3 xkb: support converting Qt keys to keysyms
QXkbCommon::toKeysym doesn't correctly handle the case where a single Qt
key map to multiple keysyms.

BUG: 482847
2024-05-27 18:27:33 +00:00
David Edmundson
73425b13a4 autotests: Improve autotests for window scaling 2024-05-24 18:23:05 +00:00