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).
This commit is contained in:
Albrecht Schlosser 2023-08-13 17:07:26 +02:00
parent 5e484524c8
commit 8c5c7aa7f4

View File

@ -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 {