[libinput] Add a wrapper class Device for a libinput_device
ClosedPublic

Authored by graesslin on May 4 2016, 11:47 AM.

Details

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.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 3638.May 4 2016, 11:47 AM
graesslin retitled this revision from to [libinput] Add a wrapper class Device for a libinput_device.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added a reviewer: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptMay 4 2016, 11:47 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

Debug console with two "keyboards" exposed. Sorry for phone camera foto - we are lacking proper screenshot support on Wayland.

broulik added inline comments.
debug_console.cpp
399

Those should have some context

419

Those are not tested/supported in the Device constructor

libinput/device.cpp
26

using namespace?

graesslin added inline comments.May 4 2016, 12:36 PM
debug_console.cpp
419

Yes, I decided to map all buttons here.

graesslin updated this revision to Diff 3640.May 4 2016, 1:08 PM
  • i18nc
  • config features exposed
graesslin marked an inline comment as done.May 4 2016, 1:09 PM
graesslin updated this revision to Diff 3641.May 4 2016, 2:04 PM

Also get whether the device can be disabled

sebas added a subscriber: sebas.May 5 2016, 12:36 AM

Looks good to me.

I've tested it on my laptop, and it shows all kind of devices, generally the output makes sense. When turning the laptop into tablet mode, nothing seems to happen to the keyboard device. It could be that it's just physically blocked (there's a neat mechanism which elevates the keyboard backplate so it's flush with the keys, keys are at that point not pressable anymore (also nothing shown in the debug console) as expected. Trackpoint and touchpad + buttons still work (also expected).

The window size of the debug console is a bit small on my display, it only covers about ten lines of the view, and I can't seem to resize the debug console window, so it's a bit fiddly.

In D1538#28537, @sebas wrote:

Looks good to me.

I've tested it on my laptop, and it shows all kind of devices, generally the output makes sense. When turning the laptop into tablet mode, nothing seems to happen to the keyboard device. It could be that it's just physically blocked (there's a neat mechanism which elevates the keyboard backplate so it's flush with the keys, keys are at that point not pressable anymore (also nothing shown in the debug console) as expected. Trackpoint and touchpad + buttons still work (also expected).

pity :-( but somehow I expected that.

The window size of the debug console is a bit small on my display, it only covers about ten lines of the view, and I can't seem to resize the debug console window, so it's a bit fiddly.

Yeah, I need to look into making it a proper window. So far KWin had never been able to manage it's own windows. Now with Wayland that becomes a possibility.

This revision was automatically updated to reflect the committed changes.