diff --git a/dgl/src/Cairo.cpp b/dgl/src/Cairo.cpp index a298335f..f92e3bd2 100644 --- a/dgl/src/Cairo.cpp +++ b/dgl/src/Cairo.cpp @@ -757,6 +757,9 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const void TopLevelWidget::PrivateData::display() { + if (! selfw->pData->visible) + return; + const Size size(window.getSize()); const uint width = size.getWidth(); const uint height = size.getHeight(); diff --git a/dgl/src/OpenGL.cpp b/dgl/src/OpenGL.cpp index 925b5abc..ad179532 100644 --- a/dgl/src/OpenGL.cpp +++ b/dgl/src/OpenGL.cpp @@ -611,6 +611,9 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const void TopLevelWidget::PrivateData::display() { + if (! selfw->pData->visible) + return; + const Size size(window.getSize()); const uint width = size.getWidth(); const uint height = size.getHeight(); diff --git a/dgl/src/TopLevelWidgetPrivateData.cpp b/dgl/src/TopLevelWidgetPrivateData.cpp index 540d0149..5adbca95 100644 --- a/dgl/src/TopLevelWidgetPrivateData.cpp +++ b/dgl/src/TopLevelWidgetPrivateData.cpp @@ -39,6 +39,10 @@ TopLevelWidget::PrivateData::~PrivateData() bool TopLevelWidget::PrivateData::keyboardEvent(const KeyboardEvent& ev) { + // ignore event if we are not visible + if (! selfw->pData->visible) + return false; + // give top-level widget chance to catch this event first if (self->onKeyboard(ev)) return true; @@ -49,6 +53,10 @@ bool TopLevelWidget::PrivateData::keyboardEvent(const KeyboardEvent& ev) bool TopLevelWidget::PrivateData::specialEvent(const SpecialEvent& ev) { + // ignore event if we are not visible + if (! selfw->pData->visible) + return false; + // give top-level widget chance to catch this event first if (self->onSpecial(ev)) return true; @@ -59,6 +67,10 @@ bool TopLevelWidget::PrivateData::specialEvent(const SpecialEvent& ev) bool TopLevelWidget::PrivateData::characterInputEvent(const CharacterInputEvent& ev) { + // ignore event if we are not visible + if (! selfw->pData->visible) + return false; + // give top-level widget chance to catch this event first if (self->onCharacterInput(ev)) return true; @@ -69,6 +81,10 @@ bool TopLevelWidget::PrivateData::characterInputEvent(const CharacterInputEvent& bool TopLevelWidget::PrivateData::mouseEvent(const MouseEvent& ev) { + // ignore event if we are not visible + if (! selfw->pData->visible) + return false; + MouseEvent rev = ev; if (window.pData->autoScaling) @@ -89,6 +105,10 @@ bool TopLevelWidget::PrivateData::mouseEvent(const MouseEvent& ev) bool TopLevelWidget::PrivateData::motionEvent(const MotionEvent& ev) { + // ignore event if we are not visible + if (! selfw->pData->visible) + return false; + MotionEvent rev = ev; if (window.pData->autoScaling) @@ -109,6 +129,10 @@ bool TopLevelWidget::PrivateData::motionEvent(const MotionEvent& ev) bool TopLevelWidget::PrivateData::scrollEvent(const ScrollEvent& ev) { + // ignore event if we are not visible + if (! selfw->pData->visible) + return false; + ScrollEvent rev = ev; if (window.pData->autoScaling) diff --git a/dgl/src/Vulkan.cpp b/dgl/src/Vulkan.cpp index 7ec5db67..5f15d4b2 100644 --- a/dgl/src/Vulkan.cpp +++ b/dgl/src/Vulkan.cpp @@ -211,20 +211,16 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const void TopLevelWidget::PrivateData::display() { + if (! selfw->pData->visible) + return; + const Size size(window.getSize()); const uint width = size.getWidth(); const uint height = size.getHeight(); const double autoScaleFactor = window.pData->autoScaleFactor; - // FIXME anything needed here? -#if 0 - // full viewport size - if (window.pData->autoScaling) - glViewport(0, -(height * autoScaleFactor - height), width * autoScaleFactor, height * autoScaleFactor); - else - glViewport(0, 0, width, height); -#endif + // TODO // main widget drawing self->onDisplay();