ButtonMapping - 位置参数

Dav*_*vis 12 mouse xorg button mouse-wheel remapping

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

Section "InputClass"
    # ...
    Option "ButtonMapping" "1 9 3 4 5 6 7 8 2"
    # ...
EndSection
Run Code Online (Sandbox Code Playgroud)

更改数字顺序会更改鼠标按钮的行为。然而,我找不到任何描述行为如何分配的文档。有什么小文档,我帮助编写。

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

    Option "ButtonMapping" "a b c d e f g h i"
Run Code Online (Sandbox Code Playgroud)

我们将这些职位记录为:

  • a - 左键单击
  • 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
Run Code Online (Sandbox Code Playgroud)

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

use*_*.dz 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
Run Code Online (Sandbox Code Playgroud)
  • 指示鼠标(通过驱动程序)报告的密钥 ID 的位置。因此,如何订购取决于制造商,但大多数都坚持通用订单。

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

    xev -event mouse
    
    Run Code Online (Sandbox Code Playgroud)

    或者evtest显示原始事件:

    sudo evtest
    
    Run Code Online (Sandbox Code Playgroud)
  • 逻辑键是实际映射到其他地方以实现额外功能的键。在这个级别,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.
Run Code Online (Sandbox Code Playgroud)

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