From 8986abeb52bcf437c9bc132ba06915731253d5a7 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 14 May 2018 14:41:06 +0100 Subject: [PATCH] Fix PUI mouse for non-pass-through mouse modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As reported by Michael Danilov, ensure sticky mouse modes for view and flight controls don’t send button events to PUI --- src/Input/FGMouseInput.cxx | 10 ++++++++++ src/Input/FGMouseInput.hxx | 5 +++++ src/Viewer/PUICamera.cxx | 5 +---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Input/FGMouseInput.cxx b/src/Input/FGMouseInput.cxx index 879fe3dfd..ea29d8de8 100644 --- a/src/Input/FGMouseInput.cxx +++ b/src/Input/FGMouseInput.cxx @@ -704,3 +704,13 @@ bool FGMouseInput::isRightDragToLookEnabled() const return (d->rightClickModeCycle == false); } + +bool FGMouseInput::isActiveModePassThrough() const +{ + if (!d) { + return false; + } + + mouse &m = d->mice[0]; + return m.modes[m.current_mode].pass_through; +} diff --git a/src/Input/FGMouseInput.hxx b/src/Input/FGMouseInput.hxx index acf1c2ffa..989a2267a 100644 --- a/src/Input/FGMouseInput.hxx +++ b/src/Input/FGMouseInput.hxx @@ -59,6 +59,11 @@ public: * @return */ bool isRightDragToLookEnabled() const; + + /** + * @brief check if the active mode passes clicks through to the UI or not + */ + bool isActiveModePassThrough() const; private: void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea); diff --git a/src/Viewer/PUICamera.cxx b/src/Viewer/PUICamera.cxx index eea14b77d..590db5fca 100644 --- a/src/Viewer/PUICamera.cxx +++ b/src/Viewer/PUICamera.cxx @@ -164,10 +164,7 @@ public: case(osgGA::GUIEventAdapter::RELEASE): { FGMouseInput* mouseSubsystem = globals->get_subsystem()->get_subsystem(); - if (mouseSubsystem && - mouseSubsystem->isRightDragToLookEnabled() && - _mouse0RightButtonNode->getBoolValue()) - { + if (mouseSubsystem && !mouseSubsystem->isActiveModePassThrough()) { return false; }