Handle smooth scrolling

Fixes scrolling under Wayland.
pull/1464/head
Janet Blackquill 2024-06-02 21:39:24 -04:00
parent 569ac27dd7
commit a431c8b474
1 changed files with 6 additions and 2 deletions

View File

@ -467,6 +467,8 @@ public:
Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON_RELEASE_MASK |
Gdk::BUTTON_MOTION_MASK | Gdk::BUTTON_MOTION_MASK |
Gdk::SCROLL_MASK | Gdk::SCROLL_MASK |
Gdk::SMOOTH_SCROLL_MASK |
Gdk::TOUCHPAD_GESTURE_MASK |
Gdk::LEAVE_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK |
Gdk::KEY_PRESS_MASK | Gdk::KEY_PRESS_MASK |
Gdk::KEY_RELEASE_MASK); Gdk::KEY_RELEASE_MASK);
@ -576,9 +578,11 @@ protected:
gdk_event_get_scroll_deltas((GdkEvent*)gdk_event, &dx, &dy); gdk_event_get_scroll_deltas((GdkEvent*)gdk_event, &dx, &dy);
double delta; double delta;
if(dy < 0 || dir == GDK_SCROLL_UP) { if(abs(dy) > 0) {
delta = dy;
} else if(dir == GDK_SCROLL_UP) {
delta = 1; delta = 1;
} else if(dy > 0 || dir == GDK_SCROLL_DOWN) { } else if(dir == GDK_SCROLL_DOWN) {
delta = -1; delta = -1;
} else { } else {
return false; return false;