Commit graph

83 commits

Author SHA1 Message Date
David Redondo
09f786a209 Do not pass input to windows that are not painted
Passing input to windows that we do not paint is confusing as what happens
is different from what is visible on the screen.
2021-07-30 16:22:37 +02:00
David Redondo
d84198f3b8 Set component display name for touchpad and keyboard shortcuts
Otherwise they appear as "KWin" in the settings when we want them
to be "Touchpad" and "Keyboard Layout Switcher".
BUG:440259
FIXED-IN:5.23
2021-07-26 10:37:48 +02:00
Vlad Zahorodnii
964c487d4f wayland: Switch to ClientBuffer
The main motivation behind the split is to simplify client buffer code
and allow adding new features easier, for example referencing the shm
pool when a shm buffer is destroyed, or monitoring for readable linux
dmabuf file descriptors, etc.

Also, a referenced ClientBuffer cannot be destroyed, unlike the old
BufferInterface.
2021-07-23 15:33:38 +00:00
Andrey Butirsky
b45f5c3a66 fix No globalshortcuts with popup grab
BUG: 431046
2021-07-23 12:12:03 +00:00
Vlad Zahorodnii
73bfe648ef wayland: Notify Qt about activated/deactivated windows
Currently, internal windows are not marked as active. This breaks focus
logic in QtQuick.
2021-07-19 06:40:06 +00:00
Aleix Pol
0a1a4d362b tablet: Update the cursor as the surface changes
The tablet protocol offers us the cursor in a surface. This patch makes
sure we connect to the surface so that we can also refresh the
representation if the client submits a change.

BUG: 437777
2021-07-05 13:23:03 +00:00
Aleix Pol
c8a37ef27f tablet: use the right scope for the variable 2021-07-02 20:54:57 +02:00
Aleix Pol
df9978d6a1 tablet: no need to forward the cursorChanged signal
It's already emitted by updateCursor, so we were doing it twice.
2021-07-02 20:54:45 +02:00
Xaver Hugl
a4dcfbfb31 input: fix touch input getting borked on quick tile
The decorationPressId never gets reset as the decoration isn't below the
touch point anymore after the quick tile, so if we have no decoration
under the touch point reset the decorationPressId to -1.

CCBUG: 430560
2021-07-01 13:11:41 +00:00
Vlad Zahorodnii
1b2c7b248b Run clazy with qt-keywords fixit
In C++20, there will be emit() class member, which can conflict with the
emit keyword. Given that, there are plans to enable QT_NO_KEYWORDS by
default in the future.

See also
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
2021-06-08 10:49:42 +03:00
Vlad Zahorodnii
edb7867ee9 Prepend "Interactive" to interactive move resize methods
This is to improve code readability and make it easier to differentiate
between methods that are used during interactive move-resize and normal
move-resize methods in the future.
2021-05-16 13:50:25 +03:00
Aleix Pol
edd1ec389b input: Use specific API
No need to construct values that are already provided
2021-05-14 01:35:33 +02:00
Aleix Pol
8e63bd230f InternalWindowEventFilter: Also track pressed ids for touch points != 0
So far we were only tracking the first touch point, meaning that if 2
touch points were applied to the internal window and removed one, the
second's events would then be sent to Wayland, which would assert since
it didn't know it had been pressed in the first place.

This fixes InternalWindowTest::testTouch
2021-05-12 17:38:03 +00:00
Vlad Zahorodnii
0de2b73393 Introduce transient constraints api in Workspace
Currently, the Workspace has no any api to constrain one window above
another. This results in having hacks such as keepDeletedTransientAbove()

This change introduces a basic api to constrain a given window above
another. It can be used for ensuring that transient windows are placed
above their parents. It also can be used for stacking the outline window
below the move-resize window.

Internal windows may also have transient parents. Because of that, this
change makes the workspace add internal clients to the stacking order by
default. The good thing about it is that it allows us unify some input
related code for "external" windows and internal windows.
2021-05-12 11:50:38 +00:00
Vlad Zahorodnii
073b6efc14 wayland: Fix focus follows mouse policy
We want to update the input focus only if the pointer is moved. Due to
that, AbstractClient::enterEvent() checks the last seen pointer position
to decide whether the window needs to be focused.

The issue is that when the pointer moves from a decoration to a surface,
the cached pointer position will be updated to the current pointer
position, and thus the check in AbstractClient::enterEvent() will fail.

We need to update the cached pointer position only if there is a focused
decoration.
2021-05-04 09:41:22 +00:00
David Edmundson
ccc5551ff0 [Input] Unset device group user data on teardown
BUG: 436287
2021-04-28 22:43:57 +00:00
Aleix Pol
a8867e292d tablet: Show a default cursor when the cursor has not been set
In this context, the cursor will (almost) always be defined as we set it
as soon as an application is bound to it. We need to show the default
cursor if set_cursor hasn't been called yet. The way to do that is to
check whether the serial is still.
2021-04-15 15:25:55 +00:00
Aleix Pol
ca1e4a255a udev: never construct UdevDevices with a null device
It allows to trust the device we have as it's referenced. We were
already checking for pointer validity when getting them so it still
makes sense.
2021-04-15 15:00:52 +00:00
Aleix Pol
2894913f93 lockscreen: also activate lock screen windows
We are running a slightly different code path, make sure that we still
honour conventions like screen focus.

BUG: 427882
2021-04-09 12:18:29 +00:00
Andrey Butirsky
91f47c9092 fix global shortcuts for non-Latin symbols
Re-use Qt's implementation of handling non-Latin layouts here
For full ASCII range support (Alt+`, etc.) Qt needs to be patched still,
see QTBUG-90611

BUG: 375518
2021-04-05 19:39:06 +00:00
Vlad Zahorodnii
6fdfd8be5f wayland: Switch to new keyboard event notify methods in SeatInterface 2021-03-26 12:33:12 +02:00
Xaver Hugl
ad7a826ea1 Drag'n'drop: only activate clients after still hover
BUG: 395368
2021-03-25 12:40:16 +00:00
Vlad Zahorodnii
5c15cca190 wayland: Switch to SeatInterface::notifyPointerButton() 2021-03-23 11:20:50 +02:00
Vlad Zahorodnii
ade861d6de Refactor session code
At the moment, the session code is far from being extensible. If we
decide to add support for libseatd, it will be a challenging task with
the current design of session management code. The goal of this
refactoring is to fix that.

Another motivation behind this change is to prepare session related code
for upstreaming to kwayland-server where it belongs.
2021-03-23 08:01:19 +00:00
Xaver Hugl
20fca90855 Consider the tool type for distinguishing between tools 2021-03-14 23:58:17 +01:00
Vlad Zahorodnii
75d39f6a8e Revert "wayland: Emulate tablet events only if there is pointer"
This reverts commit ee54fa7898.

Unfortunately, this is not a totally correct fix. If there's no pointer,
we need to announce the wl_pointer capability anyway so clients that do
not support tablet input devices can still receive emulated pointer
events.
2021-03-12 14:13:20 +02:00
Vlad Zahorodnii
ee54fa7898 wayland: Emulate tablet events only if there is pointer
If the seat has no pointer, there is no point for emulating tablet
events.
2021-03-12 10:20:22 +00:00
Vlad Zahorodnii
7b68644974 wayland: Adjust input code to SeatInterface with some renamed methods 2021-03-12 10:19:47 +00:00
Vlad Zahorodnii
00fcc3a423 wayland: Adjust kwin to SeatInterface changes 2021-03-11 07:36:31 +00:00
Vlad Zahorodnii
83388295c8 wayland: Adjust kwin to PointerInterface changes 2021-03-10 14:10:16 +00:00
Vlad Zahorodnii
d23dab7be9 wayland: Fix handling of synthetic touch cancel events
In case the compositor wants to cancel a touch sequence, we need to
ignore subsequent touch motion and touch up events until a new sequence
is initiated by the user.

Previously, it was implicitly handled by clearing the mapping table
between the touch slots and touch ids generated by kwayland-server.
2021-02-16 17:53:30 +00:00
Vlad Zahorodnii
311a370d77 wayland: Port kwin to SeatInterface::touchDown() changes 2021-02-16 06:54:39 +00:00
Vlad Zahorodnii
93e0265e4e Move source code to src/ directory
Once in a while, we receive complaints from other fellow KDE developers
about the file organization of kwin. This change addresses some of those
complaints by moving all of source code in a separate directory, src/,
thus making the project structure more traditional. Things such as tests
are kept in their own toplevel directories.

This change may wreak havoc on merge requests that add new files to kwin,
but if a patch modifies an already existing file, git should be smart
enough to figure out that the file has been relocated.

We may potentially split the src/ directory further to make navigating
the source code easier, but hopefully this is good enough already.
2021-02-10 15:31:43 +00:00
Renamed from input.cpp (Browse further)