From bef6d890f57b4750cc1afb9ad1407f440214c804 Mon Sep 17 00:00:00 2001 From: Christopher Chavez Date: Mon, 22 Jul 2019 13:52:37 +0000 Subject: [PATCH] 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 many modern Linux and BSD distributions. Signed-off-by: Christopher Chavez --- hw/xquartz/X11Application.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 821e1c5a1..aa05e891d 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -1473,7 +1473,8 @@ wait_for_mieq_init(void); goto handle_mouse; case NSOtherMouseDown: - ev_button = 2; + ev_button = [e buttonNumber] + 1; + ev_button = (ev_button == 3) ? 2 : (ev_button + 4); ev_type = ButtonPress; goto handle_mouse; @@ -1488,7 +1489,8 @@ wait_for_mieq_init(void); goto handle_mouse; case NSOtherMouseUp: - ev_button = 2; + ev_button = [e buttonNumber] + 1; + ev_button = (ev_button == 3) ? 2 : (ev_button + 4); ev_type = ButtonRelease; goto handle_mouse; @@ -1503,7 +1505,8 @@ wait_for_mieq_init(void); goto handle_mouse; case NSOtherMouseDragged: - ev_button = 2; + ev_button = [e buttonNumber] + 1; + ev_button = (ev_button == 3) ? 2 : (ev_button + 4); ev_type = MotionNotify; goto handle_mouse; -- 2.21.0