32 Commits (1d24264e456257b054ebcb5f2488374a2f546bf7)

Author SHA1 Message Date
Martin Gräßlin 9b187f8a3b [libinput] Properly handle threaded Device creation
Summary:
Device is created from Connection::processEvents which is run in the
main gui thread, while Connection itself is in a different thread. Thus
passing *this* as parent is wrong.

This change removes the parent, moves the created Device into the
Connection thread and also deletes properly by using deleteLater.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1746
8 years ago
Martin Gräßlin c04f193532 [libinput] A not valid LibInput::Context should return -1 as filedescriptor
0 is a valid filedescriptor after all.

Autotest extended to cover this case.
8 years ago
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
8 years ago
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
8 years ago
Martin Gräßlin 72d9472674 Fix auto-complete failure 8 years ago
Martin Gräßlin 82d2a2f9f1 [libinput] Track all created Devices in Device
Summary:
Device has a static QVector<Device*> into which each created Device
is added and provides a static method to match a libinput_device* to
the already created Device.

This can be used by the the libinput Event class wrapper to properly
reference the Device the event is for.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1665
8 years ago
Martin Gräßlin 9cdd76f20d [libinput] Expose whether an alpha-numeric keyboard is connected
Summary: Similar to the already existing hasKeyboard, hasTouch and hasPointer.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1671
8 years ago
Martin Gräßlin 5e284224ee [libinput] Support toggleTouchpad
Summary:
The LibInput::Device provides a way to enable/disable the device.
This is used by the Connection to toggle all touchpad devices on/off
when the touchpad key is pressed. For this KWin "steals" the global
shortcuts from the touchpad kded.

Detecting what is a touchpad is unfortunately not tivial. The code
uses the following approach:
* it's a pointer
* it's not also a keyboard or touch screen
* it's at least one of the following:
 ** supports multiple tap fingers
 ** supports disable while typing
 ** supports disable on external mouse

If the code finds a touchpad and changes it's state successfully,
it triggers the touchpadEnabledChanged on Plasma's osdService.

Test Plan: Tested on notebook with toggle touchpad button

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1545
8 years ago
Martin Gräßlin 78c70a0775 [lbinput] Support setting pointer acceleration
Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1544
8 years ago
Martin Gräßlin 254573bee1 [libinput] Support for left-handed pointer
Summary:
The configuration file kcminput, group Mouse is parsed to decide whether
pointer devices should be in left handed mode. The config is applied
whenever a new device is added.

In addition the Connection listens to KGlobalSettings for a mouse
settings changed signal which might be emitted by the mouse KCM.

When such a signal is emitted, all pointer devices are reconfigured.

This allows to change the mouse handed settings on Wayland.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1543
8 years ago
Martin Gräßlin 4c9c0c5143 [libinput] Try to fix build on build.kde.org
Apparently libinput is too old and LIBINPUT_DEVICE_CAP_TABLET_TOOL is
not yet available. As we don't use it yet, it's put into the #if 0 part
for future use.
8 years ago
Martin Gräßlin 4d7134f6c7 [libinput] Add a wrapper class Device for a libinput_device
Summary:
The Device class wraps all the information we can get from libinput
about the device, like whether it's a keyboard, pointer, touch, etc.

In addition some more information is queried to figure out how "useful"
a device is. For a keyboard all alphanumeric keys are checked whether
they exist, for a pointer all (normal) buttons are queried.

All the information is exposed as Q_PROPERTY and used by the
DebugConsole. The DebugConsole gained a new tab "Input Devices" which
renders all devices and their properties in a tree view. When plugging
in/out a device, the model gets reset, so it's always up to date.

The new Device class can be used in future to configure the device,
e.g. disable touch pad, set mouse acceleration, etc.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1538
8 years ago
Martin Gräßlin cc64bb25ae Fix build of stable branch on build.kde.org
CI system doesn't have Qt 5.5 yet, let's not break because of
qCInfo.
9 years ago
Martin Gräßlin eca06ecb02 [libinput] Install a log handler
Let's get all debug events from libinput and forward them to a custom
log handler. This in turn can pass them to Qt's categorized logging.
So it's still easy to
* disable all libinput related logging
* configure the log level

Both was not possible before.
9 years ago
Martin Gräßlin 5904349c69 [libinput] Event compression for PointerAxis 9 years ago
Martin Gräßlin 123e361f55 [libinput] Pointer motion event compression
If we have multiple pointer motion events we compress it to just one.
9 years ago
Martin Gräßlin cebd723c2c [libinput] Add an event queue
The Connection thread fills the event queue, it gets read from the
main thread. In order to properly support the threaded approach the
setup is changed to delegate into the own thread.
9 years ago
Martin Gräßlin 1cfd72f49f [libinput] Use a dedicated thread for libinput
When the Connection is created we move it into a dedicated thread
so that even processing happens in the thread. Currently all events
are still queued directly.
9 years ago
Martin Gräßlin ea77d32259 [libinput] Make signals queueable
* Declare and register enums as metatypes
* quint32 instead of uint32_t
9 years ago
Martin Gräßlin 6b95705f24 [libinput] Don't change default log level
With this change libinput is less noisy and only prints errors to stderr.

In addition one could install a dedicated log handler and forward to
qCDebug and friends.
9 years ago
Martin Gräßlin fe28ca1d8a [libinput] Add dedicated logging category for libinput 9 years ago
Martin Gräßlin efa0500313 [libinput] Bind libinput support to VirtualTerminal
This change is motivated by the fact that we need to suspend libinput
before switching the virtual terminal. Also we don't want to take over
libinput if we do not have a VirtualTerminal created - in windowed mode
we don't want libinput to be started. So binding it to the backends which
create the VirtualTerminal makes sense.

The KWin::Application gains a new signal virtualTerminalCreated which is
emitted from VirtualTerminal once it's properly setup. This is used by
Input to create Libinput integration instead of binding it to logind.

Furthermore Libinput gets suspended when the VirtualTerminal reports that
it is no longer active. For re-activation we still just use logind's
session active property.
10 years ago
Martin Gräßlin e6b076df9c Move Udev into an own header and implementation
For a DRM backend we also need Udev, so don't bundle with libinput.
10 years ago
Martin Gräßlin 61579506e3 [input] Only update seat state if session is active
When our session gets inactive libinput loses all devices, thus our
Seat would not have neither keyboard, pointer nor touch. To not confuse
all connected clients we block updates while libinput is suspended. After
resume we check whether something actually changed and emit the
corresponding signals to ensure everything is up to date.
10 years ago
Martin Gräßlin f7bed6a003 [libinput] Pass device capabilities to Wayland::Server::SeatInterface
We handle device added/remove to monitor whether we have keyboard,
pointer and touch devices and emit signals. Those are used to update
the SeatInferface from InputRedirection.
10 years ago
Martin Gräßlin 93b3626a37 [libinput] Try to dispatch events directly after setup
Without we might end in a race as kwin_wayland might start the Xwayland
server before we have a populated seat interface.
10 years ago
Martin Gräßlin 60783b8228 Touch support in libinput 10 years ago
Martin Gräßlin e886bd7c78 Adjust to newer libinput and require at least 0.10
There was API changes regarding axis event handling.
CCBUG: 342893
10 years ago
Martin Gräßlin 11fd9f69c1 Fix build with clang and gcc 5.0
BUG: 343529
FIXED-IN: 5.2.1
10 years ago
Martin Gräßlin 6a032e78b7 Suspend/Resume libinput when logind session Active changes
LogindIntegration starts monitoring the Active property on the session
and emits a signal when the state changes. The LibInput::Connection
connects to this signal during the setup and uses it to suspend/resume
the libinput context.
10 years ago
Martin Gräßlin a918591fef Use Logind to open/close devices needed by libinput
With libinput we have the problem that we need to have privileges to
open the device files. In order to not need wrappers or suid bits, we
use logind. This means that kwin_wayland has to be the session controler.

A LogindIntegration is added to connect to logind and wrap the dbus
calls. This is based on the logind integration done for ksld in
ksmserver. The LogindIntegration is started by Workspace and the
InputRedirection tries to become the session controller and starts the
libinput integration only after this succeeded.
10 years ago
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.
10 years ago