1
0
Fork 0

Fix PUI mouse for non-pass-through mouse modes

As reported by Michael Danilov, ensure sticky mouse modes for view and
flight controls don’t send button events to PUI
This commit is contained in:
James Turner 2018-05-14 14:41:06 +01:00
parent 6f5fa7a3c0
commit 8986abeb52
3 changed files with 16 additions and 4 deletions

View file

@ -704,3 +704,13 @@ bool FGMouseInput::isRightDragToLookEnabled() const
return (d->rightClickModeCycle == false); 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;
}

View file

@ -59,6 +59,11 @@ public:
* @return * @return
*/ */
bool isRightDragToLookEnabled() const; bool isRightDragToLookEnabled() const;
/**
* @brief check if the active mode passes clicks through to the UI or not
*/
bool isActiveModePassThrough() const;
private: private:
void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea); void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea);

View file

@ -164,10 +164,7 @@ public:
case(osgGA::GUIEventAdapter::RELEASE): case(osgGA::GUIEventAdapter::RELEASE):
{ {
FGMouseInput* mouseSubsystem = globals->get_subsystem<FGInput>()->get_subsystem<FGMouseInput>(); FGMouseInput* mouseSubsystem = globals->get_subsystem<FGInput>()->get_subsystem<FGMouseInput>();
if (mouseSubsystem && if (mouseSubsystem && !mouseSubsystem->isActiveModePassThrough()) {
mouseSubsystem->isRightDragToLookEnabled() &&
_mouse0RightButtonNode->getBoolValue())
{
return false; return false;
} }