From aa638f4d4833f3d3df29835b1b5d146ffa4f80e8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Sep 2020 09:15:59 +1000 Subject: [PATCH] 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 --- .../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 abf07510a..82719e7d8 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; }