Commit Graph

16 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Méven Car 564c739371 Wayland: Allow to set a scroll Factor for input devices
Summary:
Mouse and touchpad wheel events are concerned.

CCBUG: 403843

KCM patch: D28331

Test Plan: build, ctest, manual set of scrollfactor value via qdbusviewer

Reviewers: #kwin, davidedmundson, zzag, bport, ervin, apol

Reviewed By: #kwin, davidedmundson, ervin, apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28310
2020-04-07 19:08:49 +02:00
Aleix Pol f5a73b87e3 Initial support for tablets on Wayland
Summary:
This includes support for them on libinput and turns it into fake
pointer actions.
This doesn't implement zwp_tablet, this will have to happen in an
iteration later.

Test Plan:
Been playing around with it, see video.
https://www.youtube.com/watch?v=GF1WbO8FVvU

Reviewers: #plasma, #kwin, romangg

Reviewed By: #plasma, #kwin, romangg

Subscribers: zzag, davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25663
2019-12-10 21:56:31 +01:00
Vlad Zagorodniy 7f593a67ad Send axis_source, axis_discrete, and axis_stop
Summary:
So far KWin didn't send axis_source, axis_discrete, and axis_stop. Even
though most of those events are optional, clients need them to work as
expected. For example, one needs axis_source and axis_stop to implement
kinetic scrolling; Xwayland needs axis_discrete to prevent multiple
scroll events when the compositor sends axis deltas greater than 10, etc.

BUG: 404152
FIXED-IN: 5.17.0

Test Plan:
* Content of a webpage in Firefox is moved by one line per each mouse
  wheel "click";
* Scrolled gedit using 2 fingers on GNOME Shell, sway, and KDE Plasma;
  in all three cases wayland debug looked the same (except diagonal scroll
  motions).

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19000
2019-05-17 12:06:10 +03:00
Martin Flöser dca8023207 Merge branch 'Plasma/5.12' 2018-02-03 16:04:05 +01:00
Martin Flöser 6c00cfb5c7 [libinput] Ensure Event::device returns a proper Device
Summary:
This fixes a problem when a Device added and another event on the Device
are queued together. In that case the second event would not get the
Device set as it's not yet created.

This change ensures that when accessing device the pointer will be
updated.

BUG: 389674
FIXED-IN: 5.12.0

Reviewers: #kwin, #plasma, fvogt

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10236
2018-02-03 16:03:10 +01:00
Martin Flöser 4cc1d7a245 Require libinput version 1.9
Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9930
2018-01-21 11:15:41 +01:00
Martin Flöser ac2f41c86d [libinput] Add support for switch devices and events
Summary:
This change adds support for the switch devices introduces with libinput
1.7 (lid) and 1.9 (tablet mode). So far it's not yet used internally in
KWin, but only exposed through the Device and Events.

As KWin currently only requires libinput 1.5 and we are rather late in
the release cycle the new functionality is ifdef'ed. The requirement
will be raised once master is 5.13. It is already available on
build.kde.org, but e.g. Neon only has 1.6.

The switch events are interesting as they report whether the lid is
closed (might be interesting for e.g. powerdevil) and whether a
convertible is in tablet mode (supported for e.g. Lenovo Yogas with
recent kernel). This can be used by KWin internally to enable/disable
the virtual keyboard. And can be exposed globally to switch to Plasma
Mobile shell in future.

Test Plan:
Only through test case as my Lenovo Yoga uses Neon which has a
too old libinput

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9516
2018-01-04 18:05:44 +01:00
Jesse Pullinen 0eba3f3c18 Fix TouchEvent::id() returning -1, fixes a crash
Summary:
Libinput returns -1 when calling libinput_event_touch_get_slot on an event
from a single-touch touchscreen. The returned value is used in
DecorationEventFilter to determine the touch which is acting on it. The value -1
is used to signify that the decoration is not being acted on. Thus when
releasing the touch, it checks whether it was being dragged, and as it thinks
it isn't, it doesn't handle it and the decoration is still being dragged.
Clicking on the decoration then crashes kwin.

Test Plan: Move a window by dragging the decoration with a single-touch touchscreen.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7854
2017-09-19 07:11:40 +03: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 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 6d090cd263 [libinput] Add the Device to Event
Summary:
The Event class now holds a pointer to the Device and not only to the
native libinput_device.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1666
2016-05-30 15:23:38 +02:00
Martin Gräßlin 60783b8228 Touch support in libinput 2015-03-25 16:40:17 +01:00
Martin Gräßlin e886bd7c78 Adjust to newer libinput and require at least 0.10
There was API changes regarding axis event handling.
CCBUG: 342893
2015-03-20 12:42:57 +01:00
Martin Gräßlin c4bb3d11fc Initial support for libinput
Libinput is an optional dependency for getting low level input events.
As opening the input devices requires root privs this is rather
pointless in the current state. But there is a small added test app which
can be executed with root privs to demonstrate the functionality. To
properly get input events we need a wrapper like it's used in weston.

So far the following is setup:
* opening devices found by udev
* forwarding keyboard events to InputRedirection
* forwarding pointer button events to InputRedirection
* forwarding pointer axis events to InputRedirection
* signals emitted for pointer motion events

Pointer motion events need some further work as they are provided
as delta events. We need to track that and map them properly.

Also missing are touch events due to me not having a touch screen.
It should be fairly simple to setup the touch events, though.

Also hotplugging of devices is not yet implemented.
2014-10-20 14:51:24 +02:00