From 8c5c7aa7f43ac3ccbcee3c56629022a9643e2ab9 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 13 Aug 2023 17:07:26 +0200 Subject: [PATCH] Handle shift + mousewheel event on Linux (STR 3521) Pressing the shift key while using the mousewheel changes horizontal to vertical scrolling and vice versa. This allows users with a standard mouse with only one scroll button to use it for both scrolling directions. Note: other mice that have either two buttons or a scroll ball can generate both horizontal and vertical scrolling in one action. This commit does not affect such behavior. This patch has been provided by Manolo in file 'scroll.patch' (see STR 3521). --- src/Fl_x.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 6922ac819..f679375d5 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1911,16 +1911,16 @@ int fl_handle(const XEvent& thisevent) Fl::e_keysym = FL_Button + xevent.xbutton.button; set_event_xy(window); Fl::e_dx = Fl::e_dy = 0; - if (xevent.xbutton.button == Button4) { + if (xevent.xbutton.button == Button4 && !Fl::event_shift()) { Fl::e_dy = -1; // Up event = FL_MOUSEWHEEL; - } else if (xevent.xbutton.button == Button5) { + } else if (xevent.xbutton.button == Button5 && !Fl::event_shift()) { Fl::e_dy = +1; // Down event = FL_MOUSEWHEEL; - } else if (xevent.xbutton.button == 6) { + } else if (xevent.xbutton.button == 6 || (xevent.xbutton.button == Button4 && Fl::event_shift())) { Fl::e_dx = -1; // Left event = FL_MOUSEWHEEL; - } else if (xevent.xbutton.button == 7) { + } else if (xevent.xbutton.button == 7 || (xevent.xbutton.button == Button5 && Fl::event_shift())) { Fl::e_dx = +1; // Right event = FL_MOUSEWHEEL; } else {