From 38ca30cbd5937ba79f13a27e3df6d997a9db40ef Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Wed, 13 Feb 2013 12:10:25 +0100 Subject: [PATCH] Ignore events if canvas::Window is not visible --- src/Canvas/gui_mgr.cxx | 2 +- src/Canvas/window.cxx | 6 ++++++ src/Canvas/window.hxx | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Canvas/gui_mgr.cxx b/src/Canvas/gui_mgr.cxx index 160671eff..91424d9b2 100644 --- a/src/Canvas/gui_mgr.cxx +++ b/src/Canvas/gui_mgr.cxx @@ -345,7 +345,7 @@ bool GUIMgr::handleMouse(const osgGA::GUIEventAdapter& ea) static_cast(layer->getChild(j)->getUserData()) ->window.lock(); - if( !window->isCapturingEvents() ) + if( !window->isCapturingEvents() || !window->isVisible() ) continue; float margin = window->isResizable() ? resize_margin_pos : 0; diff --git a/src/Canvas/window.cxx b/src/Canvas/window.cxx index e47535bfc..126212aa7 100644 --- a/src/Canvas/window.cxx +++ b/src/Canvas/window.cxx @@ -109,6 +109,12 @@ namespace canvas return _image.getSrcCanvas(); } + //---------------------------------------------------------------------------- + bool Window::isVisible() const + { + return _image.isVisible(); + } + //---------------------------------------------------------------------------- bool Window::isResizable() const { diff --git a/src/Canvas/window.hxx b/src/Canvas/window.hxx index 00eb58737..44bfafaea 100644 --- a/src/Canvas/window.hxx +++ b/src/Canvas/window.hxx @@ -56,6 +56,7 @@ namespace canvas void setCanvas(simgear::canvas::CanvasPtr canvas); simgear::canvas::CanvasWeakPtr getCanvas() const; + bool isVisible() const; bool isResizable() const; bool isCapturingEvents() const; -- 2.39.5