diff options
Diffstat (limited to 'plugingui/nativewindow_x11.cc')
-rw-r--r-- | plugingui/nativewindow_x11.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index f50551e..a4e9659 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -28,6 +28,7 @@ #include <X11/Xutil.h> #include <stdlib.h> +#include <chrono> #include <hugin.hpp> @@ -459,6 +460,15 @@ std::shared_ptr<Event> NativeWindowX11::translateXMessage(XEvent& xevent, (xevent.type == ButtonPress) ? Direction::down : Direction::up; + // This is a fix for hosts (e.g. those using JUCE) that set the + // event time to '0'. + if(xevent.xbutton.time == 0) + { + auto now = std::chrono::system_clock::now().time_since_epoch(); + xevent.xbutton.time = + std::chrono::duration_cast<std::chrono::milliseconds>(now).count(); + } + buttonEvent->doubleClick = (xevent.type == ButtonPress) && ((xevent.xbutton.time - last_click) < 200); |