xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 24 01:06:10 UTC 2019


 hw/xquartz/X11Application.m |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 4f27d1e05f67eb8953a9bbed7e6f34b03456c64f
Author: Christopher Chavez <chrischavez at gmx.us>
Date:   Sat Jul 27 10:51:57 2019 -0500

    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 <chrischavez at gmx.us>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 821e1c5a1..f7b139685 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -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;
 


More information about the xorg-commit mailing list