From 843e31fea64e15af3e78354eaec78fe65ae4e590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Codru=C8=9B=20Constantin=20Gu=C8=99oi?= Date: Fri, 29 Nov 2019 22:29:35 +0000 Subject: [PATCH] Fixes reverse horizontal scrolling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fix was proposed here: https://bugzilla.xfce.org/show_bug.cgi?id=9689#c4 So I jumped in and made it part of the code, similar to how it was done for the vertical scroll. Why? You can think of the usual scroll as moving the scrollbar in a specific direction: up, down, left, right. A reverse, or natural scroll is when you want to move the content in a specific direction, which usually means going against the direction of a scrollbar. Before this fix, only the vertical was reversed, making the movement unnatural and confusing. Signed-off-by: Codruț Constantin Gușoi --- dialogs/mouse-settings/main.c | 9 +++++++-- xfsettingsd/pointers.c | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dialogs/mouse-settings/main.c b/dialogs/mouse-settings/main.c index 93a3a1f1..3d72f498 100644 --- a/dialogs/mouse-settings/main.c +++ b/dialogs/mouse-settings/main.c @@ -1168,7 +1168,8 @@ mouse_settings_device_selection_changed (GtkBuilder *builder) gint i, n; guchar *buttonmap; gint id_1 = 0, id_3 = 0; - gint id_4 = 0, id_5 = 0; + gint id_4 = 0, id_5 = 0; // Vertical scroll pointer + gint id_6 = 0, id_7 = 0; // Horizontal scroll pointer gdouble acceleration = -1.00; gint threshold = -1; GObject *object; @@ -1268,10 +1269,14 @@ mouse_settings_device_selection_changed (GtkBuilder *builder) id_4 = i; else if (buttonmap[i] == 5) id_5 = i; + else if (buttonmap[i] == 6) + id_6 = i; + else if (buttonmap[i] == 7) + id_7 = i; } g_free (buttonmap); left_handed = (id_1 > id_3); - reverse_scrolling = !!(id_5 < id_4); + reverse_scrolling = !!(id_5 < id_4) && !!(id_7 < id_6); } else { diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c index cbd02998..e389e1ea 100644 --- a/xfsettingsd/pointers.c +++ b/xfsettingsd/pointers.c @@ -505,6 +505,13 @@ xfce_pointers_helper_change_button_mapping (XDeviceInfo *device_info, 5 /* scroll down */, !reverse_scrolling)) map_changed = TRUE; + + if (xfce_pointers_helper_change_button_mapping_swap (buttonmap, num_buttons, + 6 /* scroll left */, + 7 /* scroll right */, + !reverse_scrolling)) + + map_changed = TRUE; } /* only set on changes */ -- 2.24.0