From f3fa39437c711f75949fbe0056007e343a428062 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 27 Jan 2019 21:10:30 +0100 Subject: Fix double firering of scroll events. --- plugingui/nativewindow_x11.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'plugingui/nativewindow_x11.cc') 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->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->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)) { -- cgit v1.2.3