Commit Graph

16 Commits (c99d329125ac745d4c764c5262a8010e9b565fde)

Author SHA1 Message Date
Martin Flöser 507d83fb08 Ensure leave event is send to decoration when a window maximizes
Summary:
When clicking the maximize button without moving the mouse, the maximize
button stayed in hover state till the mouse moved. The reason for this
is that the PointerInputRedirection does not perform an update on the
geometry change of a window.

BUG: 385140
FIXED-IN: 5.11

Test Plan: Manual testing

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8016
2017-10-16 17:57:21 +02:00
Martin Gräßlin 0c5ca405cc Implement support for pointer constraints
Summary:
There are two types of constraints supported:
1. Pointer confinement
2. Pointer locking

In the case of confinement the pointer is confined to a given region of
the surface. This is comparable to general operation where the pointer
is confined to the screen region.

In the second case the pointer gets locked. That means it cannot move at
all. No further position updates are provided, only relative motion
events can go to the application. There is a hint about cursor position
update on unlock which is not yet implemented in KWayland::Server, thus
also not in this change.

The implementation in KWin grants the requests for pointer constraints
when the pointer enters the constrained region, either by pointer
movement or by e.g. stacking order changes. There is no confirmation
from user required to enter that mode. But we want to show an OSD when
the pointer gets constrained, this is not yet implemented, though.

Breaking an active constraint is relatively easy. E.g. changing the
stacking order will break the constraint if another surface is under the
cursor. Also (in case of confinement) moving the pointer to an
overlapping window breaks the confinement. But as soon as one moves the
pointer back to the window a constraint might get honoured again.

To properly break there is a dedicated event filter. It listens for a
long press of the Escape key. If hold for 3sec the pointer constraint is
broken and not activated again till the pointer got moved out of the
window. Afterward when moving in the pointer might activate again.

The escape filter ensures that the key press is forwarded to the
application if it's a short press or if another key gets pressed during
the three seconds. If the three seconds way fires, the later escape
release is not sent to the application.

This basic interaction is also ensured through an added auto test.

This change implements T4605.

Test Plan: Added auto test and nested KWin Wayland with D3488

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3506
2016-12-08 19:50:24 +01:00
Martin Gräßlin fd83366e31 Implement interactive window selection for Wayland platforms
Summary:
The interactive window selection is implemented in InputRedirection
through a dedicated InputEventFilter. The InputEventFilter so far takes
care of pointer input and keyboard input. In addition it ensures that
keyboard and pointer focus is reset on start and on end.

With this change KillWindow now also works on Wayland, but only for X11
windows, as the Wayland variant is not yet implemented.

Test Plan: Tested in nested setup, auto-tests still needed

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3365
2016-11-17 09:42:12 +01:00
Martin Gräßlin 13f142b1bf Merge branch 'Plasma/5.8' 2016-10-31 11:52:43 +01:00
Martin Gräßlin 82054a406a Send a pointer leave when triggering a move resize
Summary:
When triggering a move resize all following pointer events are grabbed
by KWin itself. Thus the correct behavior is to informe the client about
it and send a pointer leave.

This ensures that after the move resize ended the pointer gets a new
enter. By sending anew pointer enter the position gets updated to the
new position which so far did not happen and the client generated events
on the wrong position.

BUG: 371573
FIXED-IN: 5.8.3

Reviewers: #kwin, #plasma_on_wayland, broulik

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3154
2016-10-31 11:51:15 +01:00
Martin Gräßlin cc2f4e3240 Support for relative pointer motion events
Summary:
If KWin interacts with Libinput the RelativePointerManager interface
gets created on the Wayland server. The ForwardInputEventFilter does
forward the relative motion events in addition to the normal motion
events.

In order to properly support the relative motion events as they are
expected by the Wayland protocol the handling of pointer motion events
got slightly adjusted:
* Libinput Pointer event extended by the additional data points
* Libinput Pointer event carries the delta as a QSizeF instead of
QPointF
* PointerInputRedirection adjusted to take a pointer motion event with
more arguments
* Custom QMouseEvent subclass adjusted to carry the additional members

The DebugConsole is adjusted to show the relative motion events in
addition to the global position.

Test Plan:
Verified the manager object is created and verified the
events in DebugConsole. Unfortunately not aware of any test application.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2979
2016-10-12 11:26:46 +02:00
Martin Gräßlin 2feea7837a Warp the xcb pointer whenever pointer leaves an X11 surface
Summary:
For Xwayland windows we observed that passing pointer focus to another
window does not trigger proper leave events on X. Which results in e.g.
tooltip windows to show after the pointer moved to a completely
different position on a completely different surface.

This is a bug in Xwayland which will be fixed in 1.19 (already fixed in
master). Given that there is a runtime version check. Although it's fixed
in Xwayland master it's worth to carry a workaround.

To circumvent this problem KWin warps the xcb pointer to 0/0 whever an
X window loses pointer focus. That way the X window gets a proper leave
through the X protocol.

This created a problem though: when giving focus back to the X window it
started to warp the pointer for maximized windows as KWin got pointer
motion events through the X11 event filter for positions on the window
decoration. These are passed into the screen edge filter which pushes
the pointer back and warps our Wayland pointer. To solve this problem
KWin no longer performs any actions for pointer motion in the X11 event
filter if not on X11. The event filter needs to be reworked and most of
it should be moved into the Platform API, if possible.

Test Plan:
Reproduced situations where one could see that pointer updates
don't trigger leave. E.g. going from a highlighted window to the decoration.

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2531
2016-08-24 13:12:06 +02:00
Martin Gräßlin 8a83a6fef5 [libinput] Add support for gesture events
Summary:
Gesture events are swipe or pinch events on a touch pad.

This change implements basic support by:
 * wrapping them in LibInput::Event
 * processing them in LibInput::Connection and emitting
   dedicated signals
 * Forwarding them in InputRedirection to PointerInputRedirection
 * Support them in the internal input event filter
 * Printing debug information in DebugConsole

Further handling is not yet done. In future the following should be
implemented:
 * activating e.g. zoom and present windows on pinch/swipe gesture
 * forwarding non global gestures to KWayland

Note that forwarding to KWayland is not yet useful as QtWayland does
not yet have support for the unstable protocol. No Qt application could
make use of it yet. So for the moment just global gestures is the best
we can get.

Test Plan: Looked at output of DebugConsole when triggering gestures

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2359
2016-08-08 09:15:06 +02:00
Martin Gräßlin 69cbb40903 Pass LibInput::Device* through the event handlers
Summary:
The signals emitted by LibInput::Connection carry the Device for which
the input event was received. This Device is passed to the input handlers.

Custom event classes are added which extend QMouseEvent, QKeyEvent and
QWheelEvent respectively and expose the Device. The Device is only passed
around as a forward declared pointer, so even if compiled without libinput
support, it should still compile.

Event handlers which need to get access to the Device can now just cast
the event pointer to the custom class and access it. This can be used in
future to handle device specific key codes, etc.

As we don't have a proper event classes for touch events the event
handlers do not yet have access to the Device. Here the internal API
needs to be adjusted in future.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1667
2016-05-30 15:26:37 +02:00
Martin Gräßlin ff88f93852 Support touch events on KWin internal windows
Summary:
Qt's touch event API is rather difficult and complex to implement.
As none of KWin's internal windows supports multi-touch gestures yet,
this is going the easy route and just simulates a left mouse button
press. If in future need arises for touch gesture support on KWin's
internal windows, this can be added.

Test Plan: Tested on exopc with DebugConsole and auto test

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1661
2016-05-23 18:40:06 +02:00
Martin Gräßlin 73fae5e63d Support touch events in DecorationEventFilter
Summary:
Touch events are emulating mouse events, in particular left mouse
button.

With this change one can move windows through the decoration, use
the decoration buttons and also support the double click action.

As finding the decoration is pretty much exactly the same as for
pointer events, a new base class is introduces which provides the
functionality of updating the decoration and the shared common
variables.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1604
2016-05-17 07:33:02 +02:00
Martin Gräßlin 8a1f19b145 Add support for Drag'n'Drop on Wayland
Drag'n'Drop on Wayland allows us to improve the drag'n'drop experience.
When entering a window during the drag'n'drop operation, KWin raises it.

BUG: 36065
FIXED-IN: 5.6.0 (Wayland only)
2016-03-02 08:34:41 +01:00
Martin Gräßlin d15e94f326 [autotest] Add test case for cursor image
This test case verifies that the cursor image and hot spot changes
correctly when focusing a window, changes when damaged and hides.

Test shows that when focusing a window the cursor image is not
removed, neither that unfocus sets back to fallback cursor properly.
2016-02-25 08:14:48 +01:00
Martin Gräßlin 873e2b0320 Add support for Move/Resize cursor mode 2016-02-25 08:14:48 +01:00
Martin Gräßlin a029300ce5 Rework cursor image handling for Wayland
So far updating the cursor image was not really defined. It was possible
to use the cursor image from the wayland seat or have a custom set cursor
image. But there are no rules in place to decide which one to use when.

With this change a dedicated CursorImage class is introduced which tracks
the cursor image changes on the seat, on the decoration, in the effects
and so on. In addition it tracks which is the current source for the
image, that is whether e.g. the cursor from the seat or from effects
override should be used. Whenever the cursor image changes a signal is
emitted, which is connected to the signal in AbstractBackend.

Based on that the backends can directly show the image. The existing
code in the backends to install a cursor shape or to install the cursor
from the server is completely dropped. For the backend it's irrelevant
from where the image comes from.

A new feature added is that the cursor image is marked as rendered. This
is then passed on to the frame rendered in the Surface and thus animated
cursors are finally working. Unfortunately animated cursors are broken in
Qt (see https://bugreports.qt.io/browse/QTBUG-48181 ).
2016-02-25 08:14:48 +01:00
Martin Gräßlin c044ad98be Split out pointer related handling from InputRedirection
All pointer related code is moved into a new class called
PointerInputRedirection.

The main idea is to simplify the code and make it easier to maintain.
Therefore also a few changes in the setup were performed:
* before init() is called, no processing is performed
* init() is only called on Wayland and after Workspace is created
* init property is set to false once Workspace or WaylandServer is
  destroyed

Thus code can operate on the following assumptions:
* Workspace is valid
* WaylandServer is valid
* ScreenLocker integration is used

The various checks whether there is a waylandServer() and whether
there is a seat are no longer needed.

Some of the checks have been reordered to be faster in the most common
use case of using libinput. E.g. whether warping is supported is first
evaluated by the variable bound to whether we have libinput and only if
that is false the backend is checked.

The new class doesn't have signals but invokes the signals provided
by InputRedirection. I didn't want to add new signals as I consider
them as not needed. The areas in KWin needing those signals should
be ported to InputEventFilters.
2016-02-12 13:38:26 +01:00