diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2019-01-27 21:10:30 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2019-01-27 21:10:30 +0100 |
commit | f3fa39437c711f75949fbe0056007e343a428062 (patch) | |
tree | 11333bc15a9ec967d40966e99eb0211a4b2a9a4d | |
parent | 2aae9799e1d96d827ad156aeafa549deabd51e5d (diff) |
Fix double firering of scroll events.
-rw-r--r-- | plugingui/nativewindow_x11.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index 056c69f..f77a772 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -356,12 +356,15 @@ void NativeWindowX11::translateXMessage(XEvent& xevent) { if((xevent.xbutton.button == 4) || (xevent.xbutton.button == 5)) { - int scroll = 1; - auto scrollEvent = std::make_shared<ScrollEvent>(); - scrollEvent->x = xevent.xbutton.x; - scrollEvent->y = xevent.xbutton.y; - scrollEvent->delta = scroll * ((xevent.xbutton.button == 4) ? -1 : 1); - event_queue.push_back(scrollEvent); + if(xevent.type == ButtonPress) + { + int scroll = 1; + auto scrollEvent = std::make_shared<ScrollEvent>(); + scrollEvent->x = xevent.xbutton.x; + scrollEvent->y = xevent.xbutton.y; + scrollEvent->delta = scroll * ((xevent.xbutton.button == 4) ? -1 : 1); + event_queue.push_back(scrollEvent); + } } else if ((xevent.xbutton.button == 6) || (xevent.xbutton.button == 7)) { |