只需强制指针跳过像素,方法如下:
首先列出输入设备:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ PixArt USB Optical Mouse id=10 [slave pointer (2)]
⎜ ↳ ETPS/2 Elantech Touchpad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ USB2.0 UVC 2M WebCam id=9 [slave keyboard (3)]
↳ Asus Laptop extra buttons id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
↳ USB Keyboard id=11 [slave keyboard (3)]
↳ USB Keyboard id=12 [slave keyboard (3)]
在示例中,我们看到鼠标ID为10。接下来列出其属性:
$ xinput list-props 10
Device 'PixArt USB Optical Mouse':
Device Enabled (140): 1
Coordinate Transformation Matrix (142): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (265): 0
Device Accel Constant Deceleration (266): 1.000000
Device Accel Adaptive Deceleration (267): 1.000000
Device Accel Velocity Scaling (268): 10.000000
Device Product ID (260): 2362, 9488
Device Node (261): "/dev/input/event5"
Evdev Axis Inversion (269): 0, 0
Evdev Axes Swap (271): 0
Axis Labels (272): "Rel X" (150), "Rel Y" (151), "Rel Vert Wheel" (264)
Button Labels (273): "Button Left" (143), "Button Middle" (144), "Button Right" (145), "Button Wheel Up" (146), "Button Wheel Down" (147), "Button Horiz Wheel Left" (148), "Button Horiz Wheel Right" (149)
Evdev Middle Button Emulation (274): 0
Evdev Middle Button Timeout (275): 50
Evdev Third Button Emulation (276): 0
Evdev Third Button Emulation Timeout (277): 1000
Evdev Third Button Emulation Button (278): 3
Evdev Third Button Emulation Threshold (279): 20
Evdev Wheel Emulation (280): 0
Evdev Wheel Emulation Axes (281): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (282): 10
Evdev Wheel Emulation Timeout (283): 200
Evdev Wheel Emulation Button (284): 4
Evdev Drag Lock Buttons (285): 0
我们需要«坐标变换矩阵»,记住它的№142。
通过更改此属性,我们可以提高指针速度。它是一个转换矩阵,用于计算指针移动。从链接:
默认情况下,X中每个输入设备的CTM是单位矩阵。举例来说,假设您在屏幕上的点(400,197)触摸了触摸屏:
⎡ 1 0 0 ⎤ ⎡ 400 ⎤ ⎡ 400 ⎤
⎜ 0 1 0 ⎥ · ⎜ 197 ⎥ = ⎜ 197 ⎥
⎣ 0 0 1 ⎦ ⎣ 1 ⎦ ⎣ 1 ⎦
设备事件的X和Y坐标输入到计算的第二个矩阵中。计算的结果是事件的X和Y坐标映射到屏幕的位置。如图所示,身份矩阵将设备坐标映射到屏幕坐标,而没有任何更改。
因此,我们要根据x和y增加值,从而提高指针速度。我的电脑上的一个例子:
$ xinput set-prop 10 142 2.400000, 0.000000, 0.000000, 0.000000, 2.400000, 0.000000, 0.000000, 0.000000, 1.000000
是的xinput set-prop <device-id> <property-number> <property-values>
。尝试一下,直到找到合适的为止。注意:请勿更改矩阵的最后一个值。那是我尝试上班时的错误-在这种情况下,您将看不到任何区别。
致谢:我感谢xorg邮件列表中的Simon Thum,他是提供有关矩阵提示的人。
UPD:请注意,某些运行Wine的Windows游戏可能具有奇怪的指针行为(例如,注意到,无论您如何移动鼠标,旧的Counter Strike 1.6的目标都会下降,直到它凝视地板为止),在这种情况下,只需重置即可在运行游戏之前,将CTM的x和y设置为1。