We use the PMF syntax so the isValid() check is unnecessary as the
compiler will notify about wrong signal at compile time. It makes
writing autotests feel less boilerplaty.
libinput_device_get_user_data() can be used to get the associated Device
object with libinput_device. That way, we won't need to maintain a
private list of all input devices.
The .clang-format file is based on the one in ECM except the following
style options:
- AlwaysBreakBeforeMultilineStrings
- BinPackArguments
- BinPackParameters
- ColumnLimit
- BreakBeforeBraces
- KeepEmptyLinesAtTheStartOfBlocks
Occasionally, I see complaints about the file organization of kwin,
which is fair enough.
This change makes the source code more relocatable by removing relative
paths from includes.
CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories
of kwin library. This means that as long as you link against kwin target,
the real location of the source code of the library doesn't matter.
With autotests, things are not as convenient as with kwin target. Some
tests use cpp files from kwin core. If we move all source code in a src/
directory, they will need to be adjusted, but mostly only in build
scripts.
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.
Summary:
When launching the touchpad kcm we see the following warning:
Error on d-bus read of "supportedButtons"
And the Gui shows "Error while loading values. See logs for more
information. Please restart this configuration module".
By extending the unit test for reading back the properties through DBus
I noticed that it's not trivially possible to export QFlags to DBus. As
the QFlags can be implicitly casted to int, the property is changed to
an int value.
Test Plan: Test case adjusted, did not pass prior to change, passes now.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17472
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
Summary:
This change finds the screen for a touch screen device based on:
* number available screens
* output name defined on the touch screen device
* internal screen
* and physical size
The id of the screen is stored in the Device allowing to adjust the
touch points accordingly. This means instead of transferring to the
combined display size the touch points are transferred into the output
space and the position of the output is added. Thus in a multi screen
system the touch points are properly mapped to the output.
Furthermore the screen orientation is passed to the Device and a
calibration matrix is set accordingly. Thus a transformed screen has the
touch screen transformed accordingly.
Please note that this only affects libinput on Wayland and not on X11!
The x11 standalone platform needs to gain similar code.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8748
Go for a more intuitive unset behaviour of scroll method and acceleration
profile properties.
Summary:
Unsetting a scroll method should only work, if the scroll method is currently
active. For example when scroll-two-finger is active (i.e. scroll-edge,
scroll-on-button-down is not active):
* unsetting scroll-two-finger should deactivate it and activate no-scroll
* but unsetting for example scroll-edge should _not_ deactivate scroll-two-
finger and _not_ activate no-scroll
Reworked setting scroll method auto test in order to test it.
Regarding acceleration profiles: Unsetting one, should always switch to the
other possible one as long as both are supported. In this case
LIBINPUT_CONFIG_ACCEL_PROFILE_NONE is not a valid option in contrast to the
definition of the scroll method enums.
Reviewers: #kwin
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3590
This patch is made in preparation for the Touchpad KCM for Wayland.
Summary:
* KWin has a Libinput version requirement bump to 1.5
* new isTouchpad property to distinguish touchpads from mice
* new lmrTapButtonMap property
* new disableWhileTyping property
* new pointerAccelerationProfile property
* new defaultPointerAcceleration property
* save to config mechanism added for new propertys and pointerAcceleration
* new D-Bus interface org.kde.KWin.InputDeviceManager and method devicesSysNames
* removed unnecessary additional D-Bus service name org.kde.KWin.InputDevice
* changing acceleration in the Mouse KCM doesn't influence touchpads anymore
Reviewers: #kwin, #plasma, davidedmundson
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3479
This is a larger patch rewriting some parts of the config saving functionality
in device.cpp in order to:
1. Make it possible to save ScrollMode as integer instead of using three booleans
2. Simplify the addition of new keys or types in the future
Changes in detail:
a) Adds new ConfigKey ScrollMethod and removed now unnecessary keys per method
b) Adds constructors to the ConfigData struct. This allows to create ConfigData
entries for s_configData without the need of stating empty brackets and the
useage of default values.
c) Use plain member function pointers instead of std::function, in order to
compactify code and have better compile output in case something goes wrong.
c) Cleans up ScrollMethod functions and adds interface methods for transforming
the saved integer into type enum libinput_config_scroll_method.
d) Adjusts auto test for loading the ScrollMethod value from the config file.
Reviewers: #kwin, graesslin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3460
Some small improvements / fixes to the libinput backend:
- Query libinput_device_config_left_handed_get_default
- Write leftHanded property to config file
- When saving the touchpad scroll mode, write false to all other ones.
Otherwise it will always enable the last read entry after reboot.
- Use macro for setLeftHanded(bool) and setNaturalScroll(bool)
Reviewers: #kwin, graesslin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3430
Summary:
Device gets a KConfigGroup injected and supports loading device-specific
settings. This is invoked from Libinput::Connection when adding a new
Device.
Whenever a Device option is changed successfully through the DBus
interface it gets synced into the KConfigGroup, thus on next loading of
the Device it gets restored.
The config group follows a pattern of:
[libinput][vendor][product][name]
Thus every device has a specific and persistent configuration.
Test Plan: So far only tested through autotests
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D3264
From libinput documentation:
Also optional is a feature called "drag lock". With drag lock disabled,
lifting the finger will stop any drag process. When enabled, libinput
will ignore a finger up event during a drag process, provided the finger
is set down again within a implementation-specific timeout.
From libinput documentation:
A tap immediately followed by a finger down and that finger being held
down emulates a button press. Moving the finger around can thus drag
the selected item on the screen.
The capability tablet tool is new in Libinput 1.2. As build.kde.org
does not yet support this version, it's only an optional check.
So far the code only detects whether the capability exists and reports
this accordingly.
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
Summary:
The usage of libinput is completely mocked. The test covers all the
constant properties read by Device.
There are some features which are not yet tested:
* alphaNumericKeyboard
* supportedButtons
* enabled
The setters for leftHanded and pointerAcceleration are also covered
including the variants where it can fail.
Reviewers: #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D1648