ButtonMapping-位置参数


11

在X配置文件中,可以使用ButtonMapping选项映射鼠标按钮:

Section "InputClass"
    # ...
    Option "ButtonMapping" "1 9 3 4 5 6 7 8 2"
    # ...
EndSection

更改数字顺序将更改鼠标按钮的行为。但是我找不到任何描述行为分配方式的文档。什么小的文件有,我帮写。

例如,如果按钮映射是这样写的:

    Option "ButtonMapping" "a b c d e f g h i"

我们会将这些职位记录为:

  • 一个 -左击
  • b-
  • c-右键
  • d-向前滚动
  • e-向后滚动
  • f-转发
  • g-向后
  • h-水平滚动
  • i-垂直滚动

那么我的问题是:ai 的位置值实际上代表什么,它们如何映射到鼠标按钮?

更新资料

跑步xmodmap -pp表演:

$ 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

这是没有用的,因为它不包含人类可以使用的有关鼠标物理属性的信息(即,如果没有按钮名称(例如“左按钮”),则显示两列数字是无用的)。因此,尽管从技术上讲这可能会回答“它们是如何映射的”问题,但从任何实际意义上来说,这个问题都没有得到解答。


AFAICG,值是xev报告的按钮编号。因此,例如,在您的示例中,我的Kensington Slimblade轨迹球的右上按钮是数字8,分配给水平滚动(在Web浏览器中为向后)。
lfd 2014年

Answers:


2

我认为您应该这样看:

                        1 2 3 4 5 6 7 8 9  <--position-- physical keys
Option "ButtonMapping" "1 9 3 4 5 6 7 8 2" <--function-- logical keys
  • 指示由鼠标(通过驱动程序)报告的键ID的位置。因此,由制造商决定如何订购它们,但是大多数都遵循通用订单。

    鼠标仍然使用PS2之类的旧协议,它没有存储或告知可用按钮及其功能的信息的方式。因此,X服务器无法告诉您每个物理按钮的ID,只能使用xev显示X事件的工具来尝试它们:

    xev -event mouse
    

    evtest显示原始事件:

    sudo evtest
    
  • 逻辑键是实际映射到其他功能的键。在此级别上,X将它们视为:button1,button2,button3,button4,...,button24,但它不知道它们的功能。

官方参考示例:

  7.  Configuration Examples

  This section shows some example InputDevice section for popular mice.
  All the examples assume that the mouse is connected to the PS/2 mouse
  port, and the OS supports the PS/2 mouse initialization.  It is also
  assumed that /dev/mouse is a link to the PS/2 mouse port.

  Logitech MouseMan+ has 4 buttons and a wheel. The following example
  makes the wheel movement available as the button 5 and 6.

  Section "InputDevice"
          Identifier      "MouseMan+"
          Driver          "mouse"
          Option          "Device"    "/dev/mouse"
          Option          "Protocol"  "MouseManPlusPS/2"
          Option          "Buttons"   "6"
          Option          "ZAxisMapping"      "5 6"
  EndSection

  You can change button number assignment using the xmodmap command
  AFTER you start the X server with the above configuration.  You may
  not like to use the wheel as the button 2 and rather want the side
  button (button 4) act like the button 2. You may also want to map the
  wheel movement to the button 4 and 5.  This can be done by the
  following command:

          xmodmap -e "pointer = 1 6 3 2 4 5"

  After this command is run, the correspondence between the buttons and
  button numbers will be as shown in the following table.

  Physical Buttons        Reported as:
  ------------------------------------
  1 Left Button             Button 1
  2 Wheel Button            Button 6
  3 Right Button            Button 3
  4 Side Button             Button 2
  5 Wheel Negative Move     Button 4
  6 Wheel Positive Move     Button 5


  Starting in the Xorg 6.9 release, you can also achieve this in your
  configuration file by adding this to the "InputDevice" section in
  xorg.conf:

          Option "ButtonMapping" "1 6 3 2 4 5"

  For the MS IntelliMouse Explorer which as a wheel and 5 buttons, you
  may have the following InputDevice section.

  Section "InputDevice"
          Identifier      "IntelliMouse Explorer"
          Driver          "mouse"
          Option          "Device"    "/dev/mouse"
          Option          "Protocol"  "ExplorerPS/2"
          Option          "Buttons"   "7"
          Option          "ZAxisMapping"      "6 7"
  EndSection

  The IntelliMouse Explorer has 5 buttons, thus, you should give "7" to
  the Buttons option if you want to map the wheel movement to buttons (6
  and 7).  With this configuration, the correspondence between the
  buttons and button numbers will be as follows:

  Physical Buttons        Reported as:
  ------------------------------------
  1 Left Button             Button 1
  2 Wheel Button            Button 2
  3 Right Button            Button 3
  4 Side Button 1           Button 4
  5 Side Button 2           Button 5
  6 Wheel Negative Move     Button 6
  7 Wheel Positive Move     Button 7

  You can change button number assignment using xmodmap AFTER you
  started the X server with the above configuration.

          xmodmap -e "pointer = 1 2 3 4 7 5 6"

  The above command will moves the side button 2 to the button 7 and
  make the wheel movement reported as the button 5 and 6. See the table
  below.

  Physical Buttons        Reported as:
  ------------------------------------
  1 Left Button             Button 1
  2 Wheel Button            Button 2
  3 Right Button            Button 3
  4 Side Button 1           Button 4
  5 Side Button 2           Button 7
  6 Wheel Negative Move     Button 5
  7 Wheel Positive Move     Button 6

  For the A4 Tech WinEasy mouse which has two wheels and 3 buttons, you
  may have the following InputDevice section.

  Section "InputDevice"
          Identifier      "WinEasy"
          Driver          "mouse"
          Option          "Device"    "/dev/mouse"
          Option          "Protocol"  "IMPS/2"
          Option          "Buttons"   "7"
          Option          "ZAxisMapping"      "4 5 6 7"
  EndSection

  The movement of the first wheel is mapped to the button 4 and 5. The
  second wheel's movement will be reported as the buttons 6 and 7.

  The Kensington Expert mouse is really a trackball. It has 4 buttons
  arranged in a rectangle around the ball.

资料来源: ftp : //ftp.x.org/pub/current/doc/mouse.txt


这是极好的信息。不幸的是,xmodmap -pp根据文档没有显示物理按钮的名称(例如,“左按钮”,“滚轮按钮”)。请参阅我对问题的更新。
戴夫·贾维斯

@DaveJarvis,更新了我的答案。可能是://我们应该等待下一代的老鼠,聪明的老鼠!或者将来可能不需要鼠标。:)
user.dz

还是可以查询设备的公共数据库来确定其按钮映射的名称?
Dave Jarvis
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.