Skip to content

XQuartz: translate additional mouse buttons

Christopher Chavez requested to merge (removed):xquartz-buttons into master

Old behavior was to translate the middle mouse button, as well as every other button that isn't the left or right mouse button, to act as the middle mouse button (2).

New behavior is to translate only the middle mouse button to 2, and translate higher-numbered buttons to 8 and higher. This allows additional mouse buttons to behave under XQuartz more like they do by default under X11 on other platforms (e.g. Linux and BSD distributions).

Signed-off-by: Christopher Chavez chrischavez@gmx.us


I have tested this change as a patch on top of xorg-server 1.20.5 from MacPorts. In addition to testing a USB mouse with 4th and 5th shoulder buttons, I used Karabiner-Elements to simulate clicks from different mouse buttons. I used xev and Tcl/Tk to verify that the button number seen by XQuartz programs is correct.

One thing I am not sure how to handle, or whether needs to be handled, is the maximum number of buttons that may be translated this way. With Karabiner-Elements, it can generate up to AppKit button 32 (presumably this is the highest number mouse button in AppKit), but AppKit button 31 is the highest recognized (translated to button 35); generating button 32 seems to be silently ignored (and does not appear cause any warnings, errors, or crashes).

Note that buttons repurposed by the user, such as being configured in System Preferences to invoke Exposé/Mission Control, will have no effect in XQuartz.

Edited by Christopher Chavez

Merge request reports

Loading