3

我想wheel upwheel down键盘。

Pointer_Button1、Pointer_Button2 和 Pointer_Button3 在 xmodmap 上正常工作。但是 Pointer_Button4 和 Pointer_Button5 不起作用。

.Xmodmap的一部分如下。

pointer = 1 2 3 4 5
keycode 10 = 1 exclam      Pointer_Button1
keycode 11 = 2 at          Pointer_Button2
keycode 12 = 3 numbersign  Pointer_Button3
keycode 13 = 4 dollar      Pointer_Button4
keycode 14 = 5 percent     Pointer_Button5

  • 然后按键盘上的Mode_switch+ 1,单击left button鼠标正确工作。
  • 然后按键盘上的Mode_switch+ 2,单击middle button鼠标正确工作。
  • 然后按键盘上的Mode_switch+ 3,单击right button鼠标正确工作。

  • 然后在键盘上按Mode_switch+ ,鼠标不起作用。4wheel up
  • 然后在键盘上按Mode_switch+ ,鼠标不起作用。5wheel down

环境:

centos$ cat /etc/centos-release
CentOS release 6.9 (Final)

ubuntu$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"

我在 ssh 上使用从 Centos(X 服务器和 X 客户端)到 Ubuntu(X 客户端)的 XForwarding。

GNOME (2.28.2) 在 Centos 上运行,键盘映射在 Ubuntu 上加载。

加载键盘映射:

ubuntu$ xmodmap ~/.Xmodmap
ubuntu$ xkbset m

然后我在这里显示 xev 输出

  1. 按下Mode_switch键盘。
  2. 1在键盘上键入。
  3. 2在键盘上键入。
  4. 3在键盘上键入。
  5. 4在键盘上键入。
  6. 5在键盘上键入。
  7. Mode_switch在键盘上释放。
  8. 点击left button 鼠标
  9. 点击middle button鼠标
  10. 点击right button 鼠标
  11. wheel up通过鼠标
  12. wheel down通过鼠标
ubuntu$xev
KeyPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056786138, (114,87), root:(116,144),
    state 0x0, keycode 134 (keysym 0xff7e, Mode_switch), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

PropertyNotify event, serial 38, synthetic NO, window 0x4400001,
    atom 0x18f (XKLAVIER_STATE), time 2056786139, state PropertyNewValue

PropertyNotify event, serial 38, synthetic NO, window 0x4400001,
    atom 0x18f (XKLAVIER_STATE), time 2056786140, state PropertyNewValue

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056796258, (114,87), root:(116,144),
    state 0x2000, button 1, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056796362, (114,87), root:(116,144),
    state 0x2100, button 1, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056796882, (114,87), root:(116,144),
    state 0x2000, button 2, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056797034, (114,87), root:(116,144),
    state 0x2200, button 2, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056797338, (114,87), root:(116,144),
    state 0x2000, button 3, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056797450, (114,87), root:(116,144),
    state 0x2400, button 3, same_screen YES

KeyPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056797746, (114,87), root:(116,144),
    state 0x2000, keycode 13 (keysym 0xfeec, Pointer_Button4), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056797842, (114,87), root:(116,144),
    state 0x2000, keycode 13 (keysym 0xfeec, Pointer_Button4), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056798810, (114,87), root:(116,144),
    state 0x2000, keycode 14 (keysym 0xfeed, Pointer_Button5), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056798874, (114,87), root:(116,144),
    state 0x2000, keycode 14 (keysym 0xfeed, Pointer_Button5), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056800250, (114,87), root:(116,144),
    state 0x2000, keycode 134 (keysym 0xff7e, Mode_switch), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

PropertyNotify event, serial 38, synthetic NO, window 0x4400001,
    atom 0x18f (XKLAVIER_STATE), time 2056800251, state PropertyNewValue

PropertyNotify event, serial 38, synthetic NO, window 0x4400001,
    atom 0x18f (XKLAVIER_STATE), time 2056800252, state PropertyNewValue

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056802997, (114,87), root:(116,144),
    state 0x0, button 1, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056803173, (114,87), root:(116,144),
    state 0x100, button 1, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056803901, (114,87), root:(116,144),
    state 0x0, button 2, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056804077, (114,87), root:(116,144),
    state 0x200, button 2, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056804501, (114,87), root:(116,144),
    state 0x0, button 3, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056804693, (114,87), root:(116,144),
    state 0x400, button 3, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056805949, (114,87), root:(116,144),
  /  state 0x0, button 4, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056805949, (114,87), root:(116,144),
    state 0x800, button 4, same_screen YES

ButtonPress event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056806909, (114,87), root:(116,144),
    state 0x0, button 5, same_screen YES

ButtonRelease event, serial 38, synthetic NO, window 0x4400001,
    root 0xa9, subw 0x0, time 2056806909, (114,87), root:(116,144),
    state 0x1000, button 5, same_screen YES

在键盘上按Mode_switch+ 1Mode_switch+2Mode_switch+被识别为,和,但+和+是和。3button1button2button3Mode_switch4Mode_switch5Pointer_Button4Pointer_Button5

ubuntu$ xmodmap -pp
There are 10 pointer buttons defined.

    Physical        Button
     Button          Code
        1              1
        2              2
        3              3
        4              4
        5              5
        6              6
        7              7
        8              8
        9              9
       10             10

当然,wheel upwheel down通过鼠标正确工作。

4

1 回答 1

0

找到了确切问题的解决方案。可能会帮助任何寻找相同的人。在 /usr/share/X11/xkb/compat/mousekeys 验证您的文件。该文件具有 Pointer_Button1/2/3 的键符定义,但没有 4 和 5 的键符定义。继续添加类似于 1/2/3 的 Pointer_Button4 和 Pointer_Button5,如下所示。并获取包含 setxkbmap、xmodmap 命令的文件。现在您的 button4 和 5 应该可以工作了。

interpret Pointer_Button4 {
action= PointerButton(button=4);
};
interpret Pointer_Button5 {
action= PointerButton(button=5);
};
于 2021-09-27T12:57:23.383 回答