From 0c7ffe412c16c10cc7ebbc1ec85db55fe16bb64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Wed, 4 Dec 2013 08:41:02 +0200 Subject: [PATCH] Fixed|UI|libdeng2|Stereo 3D: Allow enabling UI composition during busy mode Fixes an issue where the display would remain black after launching straight into a map with -g and -warp options. Also, during libdeng2 Widget tree notification, handle the situation when a widget is removed from the tree after a notification method has been called on it. --- doomsday/client/src/ui/clientwindow.cpp | 6 +++--- doomsday/libdeng2/src/widgets/widget.cpp | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doomsday/client/src/ui/clientwindow.cpp b/doomsday/client/src/ui/clientwindow.cpp index 83d1c34083..a8d15d1fd5 100644 --- a/doomsday/client/src/ui/clientwindow.cpp +++ b/doomsday/client/src/ui/clientwindow.cpp @@ -469,9 +469,6 @@ DENG2_OBSERVES(App, StartupComplete) return Continue; } - // Offscreen composition is only needed in Oculus Rift mode. - enableCompositor(VR::mode() == VR::MODE_OCULUS_RIFT); - // The canvas needs to be recreated when the GL format has changed // (e.g., multisampling). if(needRecreateCanvas) @@ -767,6 +764,9 @@ void ClientWindow::draw() // Don't run the main loop until after the paint event has been dealt with. ClientApp::app().loop().pause(); + // Offscreen composition is only needed in Oculus Rift mode. + d->enableCompositor(VR::mode() == VR::MODE_OCULUS_RIFT); + if(d->performDeferredTasks() == Instance::AbortFrame) { // Shouldn't draw right now. diff --git a/doomsday/libdeng2/src/widgets/widget.cpp b/doomsday/libdeng2/src/widgets/widget.cpp index 6150ff9c4f..74af5fc411 100644 --- a/doomsday/libdeng2/src/widgets/widget.cpp +++ b/doomsday/libdeng2/src/widgets/widget.cpp @@ -396,12 +396,20 @@ Widget::NotifyArgs::Result Widget::notifyTree(NotifyArgs const &args) { // The list of children was modified; let's update the current // index accordingly. - idx = d->children.indexOf(i); + int newIdx = d->children.indexOf(i); - // The current widget cannot be removed. - DENG2_ASSERT(idx >= 0); - - i = d->children.at(idx); + // The current widget remains in the tree. + if(newIdx >= 0) + { + idx = newIdx; + i = d->children.at(newIdx); + } + else + { + // The current widget is gone. Continue with the same index. + idx--; + continue; + } } // Continue down the tree by notifying any children of this widget.