Bug 415683 - KSettings > Screen Rotation doesn't rotate touchscreen & generates xinput error
Summary: KSettings > Screen Rotation doesn't rotate touchscreen & generates xinput error
Status: RESOLVED FIXED
Alias: None
Product: KScreen
Classification: Plasma
Component: libkscreen (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords:
: 325520 428760 431851 446165 451495 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-12-29 15:51 UTC by sac
Modified: 2022-04-29 04:06 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sac 2019-12-29 15:51:43 UTC
SUMMARY
On laptops screen rotation is only rotating the scree, but not the touchscreen, so touch input remains unrotated.

STEPS TO REPRODUCE
1. goto Settings > Display > Rotate the screen by 180° on laptops that have devices with duplicate names (e.g. Lenovo Yoga 900s) 

OBSERVED RESULT
Screen and touchpad are rotated, but touchscreen coordinates are not rotated.

EXPECTED RESULT
Coordinate Transformation Matrix must be applied for touchscreen as well.

ADDITIONAL INFORMATION
This happens because Settings is executing the following command:

xrandr -o inverted
xinput set-prop "ELAN21EF:00 04F3:2283" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop "Synaptics TM2714-003" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1

This leads to the following error:

"Warning: There are multiple devices matching 'ELAN21EF:00 04F3:2283'.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with 'pointer:' or 'keyboard:' as appropriate.

unable to find device ELAN21EF:00 04F3:2283"


So instead, settings should call the following (notice the pointer arg):

xrandr -o inverted
xinput set-prop "pointer:ELAN21EF:00 04F3:2283" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop "pointer:Synaptics TM2714-003" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
Comment 1 Roman Gilg 2019-12-30 00:26:56 UTC
I noticed this as well. I'm currently adding auto rotation support, but that's primarily aimed at Wayland. See series at https://phabricator.kde.org/D26038.

To be frank I don't know if I find the time to look into adding the rotation matrix for input devices to libkscreen's RandR backend. If you want to take a look at it feel free to submit a patch.
Comment 2 Nate Graham 2022-03-03 20:50:34 UTC
*** Bug 446165 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2022-03-03 20:50:38 UTC
*** Bug 431851 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2022-03-03 20:50:41 UTC
*** Bug 325520 has been marked as a duplicate of this bug. ***
Comment 5 Marco Martin 2022-03-04 09:05:24 UTC
Git commit 09b988e6628093e7d4c8b92cd8a0a1fe2da2f77e by Marco Martin.
Committed on 04/03/2022 at 09:05.
Pushed by mart into branch 'master'.

X11: align touchscreen to internal display

On Wayland is the compositor itself that keeps the touchscreen coordinates mapped to the size and position of the internal screen, also keeping rotation into account.
on X11, needs to be done via XInput, do it when KScreen actually applies a configuration.

M  +19   -0    CMakeLists.txt
A  +3    -0    config-X11.h.cmake
M  +7    -1    kded/CMakeLists.txt
M  +192  -0    kded/daemon.cpp
M  +4    -0    kded/daemon.h

https://invent.kde.org/plasma/kscreen/commit/09b988e6628093e7d4c8b92cd8a0a1fe2da2f77e
Comment 6 Marco Martin 2022-03-15 15:06:04 UTC
Git commit 579358f501ae978aa527a25eb3ef9dd42557db46 by Marco Martin.
Committed on 15/03/2022 at 15:02.
Pushed by mart into branch 'Plasma/5.24'.

X11: align touchscreen to internal display

On Wayland is the compositor itself that keeps the touchscreen coordinates mapped to the size and position of the internal screen, also keeping rotation into account.
on X11, needs to be done via XInput, do it when KScreen actually applies a configuration.

M  +19   -0    CMakeLists.txt
A  +3    -0    config-X11.h.cmake
M  +7    -1    kded/CMakeLists.txt
M  +192  -0    kded/daemon.cpp
M  +4    -0    kded/daemon.h

https://invent.kde.org/plasma/kscreen/commit/579358f501ae978aa527a25eb3ef9dd42557db46
Comment 7 David Edmundson 2022-03-15 17:01:09 UTC
*** Bug 428760 has been marked as a duplicate of this bug. ***
Comment 8 Nicolas Fella 2022-03-16 11:20:16 UTC
*** Bug 451495 has been marked as a duplicate of this bug. ***