触摸屏相对坐标

发布于 2024-09-24 01:39:01 字数 196 浏览 7 评论 0原文

我在触摸屏设备上使用 xrandr -o left|right|inverse|normal 旋转了 X 环境。除了触摸之外一切正常。当在屏幕上移动手指时,它会获取手指的绝对坐标,如果旋转方向相反,则将光标向相反方向移动。所以如果我向上滑动,它实际上会向下滑动。那么有没有办法配置触摸屏输入来读取相对坐标而不是绝对坐标。触摸屏驱动程序是evdev。

问候, 莱文

I've rotated X environment with xrandr -o left|right|inverse|normal on touch screen device. Everything is working OK beside touch. When moving finger on the screen, it takes absolute coordinates of finger and moves cursor in opposite direction if the rotation is inverse. So if I slide up actually it slides down. So is there a way to configure Touch screen input to read relative coordinates not absolute. Touch screen driver is evdev.

Regards,
Levon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稀香 2024-10-01 01:39:01

只要方向不改变,相对/绝对仍然不会做你想做的事。没有通用机制告诉 X 服务器以不同的方向解释指针设备。您需要以某种方式让底层设备以不同的方式报告。然而,有一种与底层设备通信的通用机制。

我的笔记本电脑内置了 Wacom 手写笔。要恢复正常方向,我可以执行以下操作:

xsetwacom set "stylus" Rotate NONE

直接与底层驱动程序对话。我还可以执行以下操作:

xinput set-int-prop stylus 'Wacom Rotation' '8' 0

通过 XInput“属性”与 X 驱动程序通信以执行相同的操作。

幸运的是,“evdev”确实允许这种重新映射。

xinput list,除了手写笔之外,还显示我的笔记本电脑的轨迹点和外部鼠标,它们均通过 evdev 运行:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ stylus                                    id=6    [slave  pointer  (2)]
⎜   ↳ eraser                                    id=7    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=14   [slave  pointer  (2)]
⎜   ↳ HID 0430:0100                             id=11   [slave  pointer  (2)]
...

xinput list-props 'HID 0430:0100'

Device 'HID 0430:0100':
        Device Enabled (135):   1
        Device Accel Profile (251):     0
        Device Accel Constant Deceleration (252):       1.000000
        Device Accel Adaptive Deceleration (254):       1.000000
        Device Accel Velocity Scaling (255):    10.000000
        Evdev Reopen Attempts (299):    10
        Evdev Axis Inversion (301):     0, 0
        Evdev Axes Swap (303):  0
        Axis Labels (304):      "Rel X" (143), "Rel Y" (144)
        Button Labels (305):    "Button Left" (136), "Button Middle" (137), "Button Right" (138), "Button Wheel Up" (139), "Button Wheel Down" (140)
        Evdev Middle Button Emulation (306):    2
        Evdev Middle Button Timeout (307):      50
        Evdev Wheel Emulation (308):    0
        Evdev Wheel Emulation Axes (309):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (310):    10
        Evdev Wheel Emulation Timeout (311):    200
        Evdev Wheel Emulation Button (312):     4
        Evdev Drag Lock Buttons (313):  0

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 1 反转我的外部鼠标。

要设置为正常:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 0 0
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 0

旋转 90 度:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 0
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 1

反转:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 1
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 0

反向旋转 90 度: 当然,

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 0 1
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 1

您需要某种方法来选择要在哪个设备上放置属性。

Relative/Absolute still won't do what you want, so long as the orientation isn't changed too. There is no generic mechanism to tell the X server to interpret pointer devices in a different orientations. You'll need to somehow get the underlying device to report differently. There is a generic mechanism for communicating with the underlying device, however.

I have a Wacom stylus built in to my laptop. To restore normal orientation, I can do the following:

xsetwacom set "stylus" Rotate NONE

which directly talks to the underlying driver. I can also do the following:

xinput set-int-prop stylus 'Wacom Rotation' '8' 0

which communicates with the X driver via XInput "properties" to do the same thing.

The "evdev" is fortunately one that does allow such remapping.

xinput list, in addition to the stylus shows my laptop's trackpoint and an external mouse which are both run via evdev:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ stylus                                    id=6    [slave  pointer  (2)]
⎜   ↳ eraser                                    id=7    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=14   [slave  pointer  (2)]
⎜   ↳ HID 0430:0100                             id=11   [slave  pointer  (2)]
...

xinput list-props 'HID 0430:0100'

Device 'HID 0430:0100':
        Device Enabled (135):   1
        Device Accel Profile (251):     0
        Device Accel Constant Deceleration (252):       1.000000
        Device Accel Adaptive Deceleration (254):       1.000000
        Device Accel Velocity Scaling (255):    10.000000
        Evdev Reopen Attempts (299):    10
        Evdev Axis Inversion (301):     0, 0
        Evdev Axes Swap (303):  0
        Axis Labels (304):      "Rel X" (143), "Rel Y" (144)
        Button Labels (305):    "Button Left" (136), "Button Middle" (137), "Button Right" (138), "Button Wheel Up" (139), "Button Wheel Down" (140)
        Evdev Middle Button Emulation (306):    2
        Evdev Middle Button Timeout (307):      50
        Evdev Wheel Emulation (308):    0
        Evdev Wheel Emulation Axes (309):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (310):    10
        Evdev Wheel Emulation Timeout (311):    200
        Evdev Wheel Emulation Button (312):     4
        Evdev Drag Lock Buttons (313):  0

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 1 inverts my external mouse.

To set to normal:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 0 0
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 0

Rotated by 90 degrees:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 0
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 1

Inverted:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 1
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 0

Rotated by 90 degrees the other way:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 0 1
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 1

You will need some way of picking out what device to put the properties on, of course.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文