Commit graph

74 commits

Author SHA1 Message Date
Severin von Wnuck
5fe9fd13ad Add timestamp to window decoration mouse events
Since 4881dd63 replaced the double click timer for OffscreenQuickView
with a time check, we need to make sure the timestamp from
XInput/libinput is passed on to the actual QMouseEvent.

BUG: 448477
2022-01-31 17:54:28 +00:00
Aleix Pol
324b172a26 Also redirect tablet events to the effects infrastructure 2022-01-21 09:33:13 +00:00
Weng Xuetian
cfa463c0ef Also forward key to input method for popup surface.
Popup may also want to use input method. If there is a keygrab, it also
need to forward input method instead of directly passing to wayland server.
2022-01-10 17:16:14 +00:00
Weng Xuetian
6cc0c204fd
Fix tests by checking if InputMethod::self() is null.
Only integration test has InputMethod instance.
2022-01-03 18:34:53 -08:00
Vlad Zahorodnii
4459463823 Make focused window and decoration mutually exclusive 2021-12-17 07:19:41 +00:00
Weng Xuetian
11f6292cb5 Move input keyboard filter to be just before the key is sent to application.
Features like global shortcuts should be handled before the input
method.
2021-12-16 03:29:00 +00:00
Xaver Hugl
6ce0cc987d input: set tablet cursor hotspot 2021-12-09 17:09:12 +00:00
Vlad Zahorodnii
bf7bdf0be8 Setup touchpad shortcuts and input event filters only on Wayland
They work only on Wayland.
2021-12-01 10:59:32 +02:00
Vlad Zahorodnii
88d423ddcf Unify focus abstractions for internal and wayland windows
This simplifies focus related logic a bit. Instead of differentiating
between wayland and internal window focus, simply maintain window focus
that works both with regular wayland windows as well as the ones created
by kwin.
2021-12-01 10:23:55 +02:00
Vlad Zahorodnii
a02ca08d45 Make focus setters in InputDeviceHandler work as expected 2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
9741b1db2f Remove unused InputDeviceHandler::atChanged signal 2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
d957e99365 Improve variable names in InputDeviceHandler 2021-11-30 10:23:54 +00:00
Xaver Hugl
33f3a13a1a wayland: show cursor if stylus is in proximity
While a stylus is in proximity we want to show its cursor. In this commit
it only gets shown on move because for a still unknown reason the position
is out of date before the first move event.

BUG: 443921
2021-11-29 17:37:58 +00:00
Aleix Pol
4dca6408c2 tablet: Provide the position when proximity-in hits 2021-11-29 17:12:58 +01:00
Fushan Wen
1719c9cc07 Enable using stylus to switch focus and operate on the decoration
Add `tabletToolEvent()` to DecorationEventFilter class so it can handle
tablet events.

Add `tabletToolEvent()` to MoveResizeFilter class to avoid incorrect
titlebar highlight after a window is resized by using a stylus.

Add `tabletToolEvent()` to WindowActionInputFilter class so window focus
can be changed by clicking on the window content area when using a stylus.

Add `update()` to `TabletInputRedirection::tabletToolEvent()` to enable
switching window focus by using a stylus.

BUG: 432104
2021-11-23 08:50:42 +08:00
David Redondo
3bebd3dce4 Start pointer gestures with fingerCount fingers not time fingers 2021-11-12 13:16:03 +01:00
Xaver Hugl
6ff4de2e05 port everything away from Q_FOREACH 2021-11-08 14:19:05 +00:00
Vlad Zahorodnii
94de28bfbe Move input backends in their own directory 2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
7f72e5627e wayland: Port fake input integration to InputDevice
This ensures that the cursor will be properly shown/hidden when a fake
pointer is added on a system with no physical pointer connected.
2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
ef72bae42f Introduce base InputDevice class
The main motivation behind this change is to prepare input abstractions
for virtual input devices so the wl_seat can properly advertise caps or
the cursor getting properly mapped/unmapped when a fake pointer is
added/removed on a system without a hardware mouse connected.

With this, there are three abstractions - InputDevice, InputBackend, and
InputRedirection.

An InputDevice represents an input device such as a mouse, a keyboard, a
tablet, etc. The InputBackend class notifies the InputRedirection about
(dis-)connected devices. The InputRedirection manages the input devices.

Such design allows to unify the event flow for real and virtual input
devices.

There can be several input backends active. For example, the libinput
backend and an input backend that provides virtual input devices, e.g.
libeis or org_kde_kwin_fake_input.
2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
e83da51844 Simplify input event flow
Currently, input events can flow directly to input device handlers and
sometimes they go through the InputRedirection, which simply forwards
them to the corresponding input device handler.
2021-10-28 10:55:48 +00:00
Vlad Zahorodnii
bbe879988d Remove redundant Workspace checks in ForwardInputFilter
They don't use Workspace, so the workspace check can be removed.
2021-10-28 11:52:08 +03:00
Vlad Zahorodnii
da6fbec424 Notify IdleInterface about user activity explicitly
In some cases, kwin may not forward input events to SeatInterface, which
can false trigger idle detection in IdleInterface.
2021-10-28 05:55:59 +00:00
David Redondo
60c3b3ddfa Add support for hold gestures 2021-10-26 08:16:52 +00:00
Andrey Butirsky
4395caa256 [wayland] fix ignored keyboard RepeatRate
X11 can take float RepeatRate, Wayland - int only so the setting is to be
rounded.
Should be indistinguishable on usual rates.

BUG: 443721
2021-10-25 14:04:33 +00:00
Xaver Hugl
0c7d97853e input: fix crash on touch quicktile
If the filter filters out touchDown it also has to always filter out the
matching touchUp
2021-10-22 09:08:27 +00: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
Xaver Hugl
5b9deafa14 InputMethod: only activate virtual keyboard when used with touch 2021-10-15 15:41:35 +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
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
d7d1c6600a wayland: Move ownership of the libinput thread to InputRedirection
When libinput tears down, it may access the Session object. This change
re-jitters the shut down logic so the Session object is guaranteed to be
valid when libinput stuff gets destroyed.

BUG: 442104
2021-09-28 14:37:47 +00:00
Ash Blake
242de43737 tablet: Check if client is supported before sending tool button
BUG: 438010
2021-09-26 09:02:21 +00:00
Aleix Pol
8825c01b15 tablet: Fix disconnecting the tablet while the pen is still in proximity
libinput will send release and proximity out events after the device is
disconnected.
This just takes into account that tablet might be nullptr.

BUG: 442573
2021-09-17 13:33:41 +00:00
David Edmundson
400dd31db6 Drop the internal connection for wayland to X drags
An AbstractDragTarget is introduced. This contains either the DataDevice we are
dragging to or an Xwl bridge.

We set this on Seat along with the active surface.

In future this also allows getting rid of the move filter.
2021-09-09 11:13:02 +00:00
Janet Blackquill
6231699ac1 Lay some groundwork for realtime gestures in Wayland
This lays down some groundwork for realtime gestures in Wayland,
so that gestures that are 1:1 with user motion on a touchpad are
now possible to implement.

Due to earlier commits, this is mostly just glue code to make a
convenient API.

Gestures implemented with this API are four-finger gestures, to
avoid conflicting with apps that may use two or three-finger
gestures.
2021-09-01 19:48:41 -04:00
Xaver Hugl
42b516b567 fix drag and drop raise with Xwayland windows
They shouldn't be raised immediately. The same strategy as with
Wayland native clients should be used.

BUG: 440534
2021-08-30 16:31:28 +02:00
Vlad Zahorodnii
9dfccfc95c Port some of kwin to Workspace::geometry() 2021-08-30 12:26:16 +03:00
Ahmad Samir
731564f04d Fix clazy warnings: potential Qt containter detaches in range-for loops
GIT_SILENT
2021-08-23 23:03:06 +00:00
Vlad Zahorodnii
c51de0f370 wayland: Don't track last focused internal window
QGuiApplication::focusWindow() can be used instead.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii
a13fd02ea8 Remove virtualdesktops.h include in toplevel.h
toplevel.h is included in many places. Changing virtualdesktops.h may
trigger rebuild of all kwin.

With this change, only cpp files that use virtualdesktops.h will need to
be recompiled.
2021-08-12 17:23:15 +00:00
David Redondo
3b9ffdfbf6 Revert "Do not pass input to windows that are not painted"
This reverts commit 09f786a209.
2021-07-30 17:08:48 +02:00
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