[mutter] backends/native: fix the scroll button lock right/middle mismatch



commit aa638f4d4833f3d3df29835b1b5d146ffa4f80e8
Author: Peter Hutterer <peter hutterer who-t net>
Date:   Wed Sep 9 09:15:59 2020 +1000

    backends/native: fix the scroll button lock right/middle mismatch
    
    In X, buttons 1, 2, 3 are left, middle, right. In evdev, the order is
    BTN_LEFT, BTN_RIGHT, BTN_MIDDLE. So setting a scroll button to 2 gave us a
    middle button in the X session and a right button in a wayland session.
    
    Fix that by hard-coding the LMR buttons handling.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1433

 src/backends/native/meta-input-settings-native.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/native/meta-input-settings-native.c 
b/src/backends/native/meta-input-settings-native.c
index abf07510aa..82719e7d83 100644
--- a/src/backends/native/meta-input-settings-native.c
+++ b/src/backends/native/meta-input-settings-native.c
@@ -287,12 +287,26 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings  *settings,
     }
   else
     {
-      /* Compensate for X11 scroll buttons */
-      if (button > 7)
-        button -= 4;
+      switch (button)
+        {
+        case 1:
+          evcode = BTN_LEFT;
+          break;
+        case 2:
+          evcode = BTN_MIDDLE;
+          break;
+        case 3:
+          evcode = BTN_RIGHT;
+          break;
+        default:
+          /* Compensate for X11 scroll buttons */
+          if (button > 7)
+            button -= 4;
+
+          /* Button is 1-indexed */
+          evcode = (BTN_LEFT - 1) + button;
+        }
 
-      /* Button is 1-indexed */
-      evcode = (BTN_LEFT - 1) + button;
       method = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]