From 0239e9c8c8f6b258e82fbf701f91ef191f21ee15 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Fri, 21 Jun 2013 21:59:58 +0200 Subject: [PATCH] Fix cursor hide timeout if hovering on canvas windows --- src/Canvas/gui_mgr.cxx | 2 +- src/Input/FGMouseInput.cxx | 4 ++++ src/Viewer/FGEventHandler.cxx | 9 ++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Canvas/gui_mgr.cxx b/src/Canvas/gui_mgr.cxx index d55ff3a65..cfee29c07 100644 --- a/src/Canvas/gui_mgr.cxx +++ b/src/Canvas/gui_mgr.cxx @@ -48,7 +48,7 @@ class GUIEventHandler: {} bool handle( const osgGA::GUIEventAdapter& ea, - osgGA::GUIActionAdapter& aa, + osgGA::GUIActionAdapter&, osg::Object*, osg::NodeVisitor* ) { diff --git a/src/Input/FGMouseInput.cxx b/src/Input/FGMouseInput.cxx index 218b3342b..6ac4c0e98 100644 --- a/src/Input/FGMouseInput.cxx +++ b/src/Input/FGMouseInput.cxx @@ -689,6 +689,10 @@ void FGMouseInput::doMouseMotion (int x, int y, const osgGA::GUIEventAdapter* ea m.timeSinceLastMove.stamp(); FGMouseCursor::instance()->mouseMoved(); + // TODO Get rid of this as soon as soon as cursor hide timeout works globally + if( ea->getHandled() ) + return; + processMotion(x, y, ea); m.x = x; diff --git a/src/Viewer/FGEventHandler.cxx b/src/Viewer/FGEventHandler.cxx index c0978b164..c3bf622e0 100644 --- a/src/Viewer/FGEventHandler.cxx +++ b/src/Viewer/FGEventHandler.cxx @@ -185,7 +185,14 @@ 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() ) + 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; int x = 0; -- 2.39.5