GitLab will be down for maintenance this Sunday 13th June, from approx 7-11am UTC. This is for a PostgreSQL migration. See the tracker issue for more informations.

Commit 4f27d1e0 authored by Christopher Chavez's avatar Christopher Chavez
Browse files

XQuartz: translate additional mouse buttons



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's avatarChristopher Chavez <chrischavez@gmx.us>
parent 436fd7e8
......@@ -1473,7 +1473,16 @@ wait_for_mieq_init(void);
goto handle_mouse;
case NSOtherMouseDown:
ev_button = 2;
// Get the AppKit button number, and convert it from 0-based to 1-based
ev_button = [e buttonNumber] + 1;
/* Translate middle mouse button (3 in AppKit) to button 2 in X11,
* and translate additional mouse buttons (4 and higher in AppKit)
* to buttons 8 and higher in X11, to match default behavior of X11
* on other platforms
*/
ev_button = (ev_button == 3) ? 2 : (ev_button + 4);
ev_type = ButtonPress;
goto handle_mouse;
......@@ -1488,7 +1497,9 @@ wait_for_mieq_init(void);
goto handle_mouse;
case NSOtherMouseUp:
ev_button = 2;
// See above comments for NSOtherMouseDown
ev_button = [e buttonNumber] + 1;
ev_button = (ev_button == 3) ? 2 : (ev_button + 4);
ev_type = ButtonRelease;
goto handle_mouse;
......@@ -1503,7 +1514,9 @@ wait_for_mieq_init(void);
goto handle_mouse;
case NSOtherMouseDragged:
ev_button = 2;
// See above comments for NSOtherMouseDown
ev_button = [e buttonNumber] + 1;
ev_button = (ev_button == 3) ? 2 : (ev_button + 4);
ev_type = MotionNotify;
goto handle_mouse;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment