From 06b026a2180cbd637093e9cd661ebd8f87d7c090 Mon Sep 17 00:00:00 2001 From: James Turner <zakalawe@mac.com> Date: Tue, 25 Aug 2020 20:48:29 +0100 Subject: [PATCH] GUI/knob animation: fire release binding over PUI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fire the release bindings for active pick callbacks, even for a ‘handled’ mouse release. This means knobs, etc will fire their release binding if the mouse is over a PUI dialog. https://sourceforge.net/p/flightgear/codetickets/2347/ --- src/Input/FGMouseInput.cxx | 6 ++++++ src/Viewer/FGEventHandler.cxx | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Input/FGMouseInput.cxx b/src/Input/FGMouseInput.cxx index f0474fab4..f7f5c4552 100644 --- a/src/Input/FGMouseInput.cxx +++ b/src/Input/FGMouseInput.cxx @@ -575,6 +575,12 @@ void FGMouseInput::doMouseClick (int b, int updown, int x, int y, bool mainWindo callbacks.pop_front(); } + + if (ea->getHandled()) { + // for https://sourceforge.net/p/flightgear/codetickets/2347/ + // we cleared the active picks, but don't do further processing + return; + } } if (mode.pass_through) { diff --git a/src/Viewer/FGEventHandler.cxx b/src/Viewer/FGEventHandler.cxx index b62acc27e..620e2bf88 100644 --- a/src/Viewer/FGEventHandler.cxx +++ b/src/Viewer/FGEventHandler.cxx @@ -123,15 +123,19 @@ bool FGEventHandler::handle(const osgGA::GUIEventAdapter& ea, // Event handlers seem to be called even if the according event has already // been handled. Already handled events shouldn't be handled multiple times // so we need to exit here manually. - if( ea.getHandled() - // Let mouse move events pass to correctly handle mouse cursor hide - // timeout while moving just on the canvas gui. - // TODO We should clean up the whole mouse input and make hide - // timeout independent of the event handler which consumed the - // event. - && ea.getEventType() != osgGA::GUIEventAdapter::MOVE - && ea.getEventType() != osgGA::GUIEventAdapter::DRAG ) - return false; + if (ea.getHandled() + // Let mouse move events pass to correctly handle mouse cursor hide + // timeout while moving just on the canvas gui. + // TODO We should clean up the whole mouse input and make hide + // timeout independent of the event handler which consumed the + // event. + + // if we see a release, still process for active pick callbacks + // https://sourceforge.net/p/flightgear/codetickets/2347/ + + && ea.getEventType() != osgGA::GUIEventAdapter::MOVE && ea.getEventType() != osgGA::GUIEventAdapter::DRAG && ea.getEventType() != osgGA::GUIEventAdapter::RELEASE) { + return false; + } int x = 0; int y = 0;