summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-08-13 17:07:26 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-08-13 17:07:26 +0200
commit8c5c7aa7f43ac3ccbcee3c56629022a9643e2ab9 (patch)
treecd4851bdb858d5f0c2a5475b84730fc044ee97ba
parent5e484524c8713697182cf50e303ecc4305f60bd4 (diff)
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).
-rw-r--r--src/Fl_x.cxx8
1 files 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 {