即使使用 TrackPoint 滚动后鼠标中键也会粘贴(在联想无线 TrackPoint 键盘 II 上)

即使使用 TrackPoint 滚动后鼠标中键也会粘贴(在联想无线 TrackPoint 键盘 II 上)

我有一台运行 Linux Mint 20.1 Cinnamon (5.4.0-74-generic) 的 Thinkpad X250。
我最近买了一台联想 ThinkPad Trackpoint Wireless II键盘,我对使用蓝牙连接时一切运行得如此顺利感到非常惊讶。(还附带一个替代的专有 USB-Dongle)。

我习惯使用鼠标中键(“按钮 2”)作为复制/粘贴(X“主要”),并在按住它然后移动 TrackPoint 时进行滚动。

但是使用新键盘时,即使我刚刚执行了滚动操作,主缓冲区也会被粘贴。
因此,我花了几天时间弄清楚内置鼠标/TrackPoint 和新的无线鼠标/TrackPoint 之间的区别,但现在我有点不知所措了。

内置“优质”X250 TrackPoint 的表现

根据 xinput,内置设备名为“TPPS/2 IBM TrackPoint”。
当我运行xin输入测试,我可以看到单击中间按钮不会立即显示。
现在当我释放按钮时,我会得到一个“按下按钮 2”和“释放按钮 2”的直接连接。
如果我在按住按钮的同时移动 TrackPoint,则释放它不会引起任何“按钮 2”操作。
(由于 TrackPoint 移动,发生了一些“运动”和“按下/释放按钮 [4-7]”操作)

无线键盘的问题

蓝牙键盘的鼠标/指点杆相关部分显示为“TrackPoint Keyboard II Mouse”。
将“xinput list-props”与两个设备进行比较,唯一的区别是滚动方式:

无线的:

libinput Scroll Method Enabled (316):   0, 0, 0
libinput Scroll Method Enabled Default (317):   0, 0, 0

内置:

libinput Scroll Method Enabled (316):   0, 0, 1
libinput Scroll Method Enabled Default (317):   0, 0, 1

虽然出于某种原因(见下文),我无法更改“libinput 滚动方法已启用默认值 (317)”属性,但我尝试了“libinput 滚动方法已启用默认值 (316)”的两种设置。
如果我正确理解了文档,那么这三个值会选择滚动方法,并对应于“双指”、“边缘”和“按钮上”滚动。
https://wayland.freedesktop.org/libinput/doc/latest/scrolling.html#scrolling

结果xin输入测试如下面所述:
使用属性 libinput 滚动方法启用(316):0, 0, 0(默认):
按下鼠标中键会立即发出“按下按钮 2”并粘贴主缓冲区。
我现在可以移动 TrackPoint(导致一些“移动”和“按下/释放按钮 [4-7]”动作),并且一旦我释放按钮,我就会看到“释放按钮 2”。

使用属性 libinput 滚动方法启用(316):0, 0, 1:
按下鼠标中键不会立即显示。
但无论我是否移动 TrackPoint,只要我释放按钮,就会立即出现“按下按钮 2”和“释放按钮 2”的提示,后者显然会触发粘贴操作。

任何状况之下,libinput 调试事件立即显示按钮/TrackPoint 数据。

键盘背面还有一个不祥的“Windows/Android”开关。
这不会改变任何东西。(我认为它只会改变特殊功能键的行为)

如上所述,键盘建议使用 USB 加密狗进行连接。这里的行为略有不同,但即使在滚动时仍会粘贴:

libinput 滚动方法已启用(316):0, 0, 0
按下按钮后立即出现“按下按钮 2”(并且缓冲区被粘贴)。
移动 TrackPoint 或释放按钮后立即出现“释放按钮 2”。

libinput 滚动方法已启用(316):0、0、1
按下按钮时什么也没有发生。
“按钮按下 2”、“按钮释放 2”和缓冲区粘贴会在 TrackPoint 移动或按钮释放时立即发生。

我希望我能够清楚地解释这个问题。我不确定下一步该怎么做。我的 /usr/share/X11/xorg.conf.d/40-libinput.conf 一直没有改变,似乎只是将“libinput”驱动程序连接到任何设备(见下文)。

自从libinput 调试事件实时显示所有硬件数据,我不认为键盘或 BlueZ 是罪魁祸首。
但话又说回来,我不知道无线键盘和内置设备的数据在哪里以及如何被如此不同地处理。
除了库输入新输入?\

非常感谢你的帮助!

$ xinput list-props "TrackPoint Keyboard II Mouse"
Device 'TrackPoint Keyboard II Mouse':
    Device Enabled (165):   1
    Coordinate Transformation Matrix (167): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (311):   0
    libinput Natural Scrolling Enabled Default (312):   0
    libinput Scroll Methods Available (315):    0, 0, 1
    libinput Scroll Method Enabled (316):   0, 0, 0
    libinput Scroll Method Enabled Default (317):   0, 0, 0
    libinput Button Scrolling Button (329): 2
    libinput Button Scrolling Button Default (330): 2
    libinput Middle Emulation Enabled (321):    0
    libinput Middle Emulation Enabled Default (322):    0
    libinput Accel Speed (323): 0.000000
    libinput Accel Speed Default (324): 0.000000
    libinput Accel Profiles Available (331):    1, 1
    libinput Accel Profile Enabled (332):   1, 0
    libinput Accel Profile Enabled Default (333):   1, 0
    libinput Left Handed Enabled (325): 0
    libinput Left Handed Enabled Default (326): 0
    libinput Send Events Modes Available (288): 1, 0
    libinput Send Events Mode Enabled (289):    0, 0
    libinput Send Events Mode Enabled Default (290):    0, 0
    Device Node (291):  "/dev/input/event23"
    Device Product ID (292):    6127, 24801
    libinput Drag Lock Buttons (327):   <no items>
    libinput Horizontal Scroll Enabled (328):   1

$ xinput list-props "TPPS/2 IBM TrackPoint"
Device 'TPPS/2 IBM TrackPoint':
    Device Enabled (165):   1
    Coordinate Transformation Matrix (167): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (311):   0
    libinput Natural Scrolling Enabled Default (312):   0
    libinput Scroll Methods Available (315):    0, 0, 1
    libinput Scroll Method Enabled (316):   0, 0, 1
    libinput Scroll Method Enabled Default (317):   0, 0, 1
    libinput Button Scrolling Button (329): 2
    libinput Button Scrolling Button Default (330): 2
    libinput Middle Emulation Enabled (321):    0
    libinput Middle Emulation Enabled Default (322):    0
    libinput Accel Speed (323): 0.000000
    libinput Accel Speed Default (324): 0.000000
    libinput Accel Profiles Available (331):    1, 1
    libinput Accel Profile Enabled (332):   1, 0
    libinput Accel Profile Enabled Default (333):   1, 0
    libinput Left Handed Enabled (325): 0
    libinput Left Handed Enabled Default (326): 0
    libinput Send Events Modes Available (288): 1, 0
    libinput Send Events Mode Enabled (289):    0, 0
    libinput Send Events Mode Enabled Default (290):    0, 0
    Device Node (291):  "/dev/input/event17"
    Device Product ID (292):    2, 10
    libinput Drag Lock Buttons (327):   <no items>
    libinput Horizontal Scroll Enabled (328):   1

$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Synaptics TM3075-002                      id=12   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=13   [slave  pointer  (2)]
⎜   ↳ TrackPoint Keyboard II Mouse              id=19   [slave  pointer  (2)]
⎜   ↳ TrackPoint Keyboard II Consumer Control   id=22   [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)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=11   [slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C           id=9    [slave  keyboard (3)]
    ↳ HD Webcam C525                            id=14   [slave  keyboard (3)]
    ↳ TrackPoint Keyboard II Keyboard           id=20   [slave  keyboard (3)]
    ↳ TrackPoint Keyboard II System Control     id=21   [slave  keyboard (3)]
    ↳ TrackPoint Keyboard II Consumer Control   id=23   [slave  keyboard (3)]

$ cat  /usr/share/X11/xorg.conf.d/40-libinput.conf 
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
#   Identifier "something or other"
#   MatchDriver "libinput"
#
#   MatchIsTouchpad "on"
#   ... other Match directives ...
#   Option "someoption" "value"
# EndSection
#
# This applies the option any libinput device also matched by the other
# directives. See the xorg.conf(5) man page for more info on
# matching devices.

Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

$ sudo libinput list-devices | grep -A 17 "TPPS"
Device:           TPPS/2 IBM TrackPoint
Kernel:           /dev/input/event17
Group:            14
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

$ sudo libinput list-devices | grep -A 17 "TrackPoint Keyboard II Mouse"
Device:           TrackPoint Keyboard II Mouse
Kernel:           /dev/input/event23
Group:            15
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

$ xinput set-prop "TrackPoint Keyboard II Mouse" 317 0, 0, 1
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  131 (XInputExtension)
  Minor opcode of failed request:  57 ()
  Serial number of failed request:  20
  Current serial number in output stream:  21

相关内容