[Scummvm-cvs-logs] SF.net SVN: scummvm: [22860] scummvm/trunk/gui
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sat Jun 3 12:48:42 CEST 2006
Revision: 22860
Author: eriktorbjorn
Date: 2006-06-03 03:48:37 -0700 (Sat, 03 Jun 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22860&view=rev
Log Message:
-----------
When the screen changes, redraw all dialogs *immediately* rather than waiting
for the main loop to check for _needRedraw. Otherwise subsequent events can
cause widgets to be redrawn before the theme has had a chance to re-open the
dialogs, and this could cause at least the modern theme to crash.
Modified Paths:
--------------
scummvm/trunk/gui/newgui.cpp
scummvm/trunk/gui/newgui.h
Modified: scummvm/trunk/gui/newgui.cpp
===================================================================
--- scummvm/trunk/gui/newgui.cpp 2006-06-03 09:43:10 UTC (rev 22859)
+++ scummvm/trunk/gui/newgui.cpp 2006-06-03 10:48:37 UTC (rev 22860)
@@ -131,6 +131,31 @@
_theme->resetDrawArea();
}
+void NewGui::redraw() {
+ int i;
+
+ // Restore the overlay to its initial state, then draw all dialogs.
+ // This is necessary to get the blending right.
+ _theme->clearAll();
+
+ for (i = 0; i < _dialogStack.size(); ++i) {
+ _theme->closeDialog();
+ }
+ for (i = 0; i < _dialogStack.size(); i++) {
+ // Special treatment when topmost dialog has dimsInactive() set to false
+ // This is the case for PopUpWidget which should not dim a dialog
+ // which it belongs to
+ if ((i == _dialogStack.size() - 2) && !_dialogStack[i + 1]->dimsInactive())
+ _theme->openDialog(true);
+ else if ((i != (_dialogStack.size() - 1)) || !_dialogStack[i]->dimsInactive())
+ _theme->openDialog(false);
+ else
+ _theme->openDialog(true);
+
+ _dialogStack[i]->drawDialog();
+ }
+}
+
void NewGui::runLoop() {
Dialog *activeDialog = _dialogStack.top();
bool didSaveState = false;
@@ -145,7 +170,6 @@
didSaveState = true;
}
- int i;
bool useStandardCurs = !_theme->ownCursor();
if (useStandardCurs) {
@@ -163,26 +187,7 @@
while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) {
if (_needRedraw) {
- // Restore the overlay to its initial state, then draw all dialogs.
- // This is necessary to get the blending right.
- _theme->clearAll();
-
- for (i = 0; i < _dialogStack.size(); ++i) {
- _theme->closeDialog();
- }
- for (i = 0; i < _dialogStack.size(); i++) {
- // Special treatment when topmost dialog has dimsInactive() set to false
- // This is the case for PopUpWidget which should not dim a dialog
- // which it belongs to
- if ((i == _dialogStack.size() - 2) && !_dialogStack[i + 1]->dimsInactive())
- _theme->openDialog(true);
- else if ((i != (_dialogStack.size() - 1)) || !_dialogStack[i]->dimsInactive())
- _theme->openDialog(false);
- else
- _theme->openDialog(true);
-
- _dialogStack[i]->drawDialog();
- }
+ redraw();
_needRedraw = false;
}
@@ -256,11 +261,14 @@
case OSystem::EVENT_SCREEN_CHANGED:
// reinit the whole theme
_theme->refresh();
- _needRedraw = true;
// refresh all dialogs
- for (i = 0; i < _dialogStack.size(); ++i) {
+ for (int i = 0; i < _dialogStack.size(); ++i) {
_dialogStack[i]->handleScreenChanged();
}
+ // We need to redraw immediately. Otherwise
+ // some other event may cause a widget to be
+ // redrawn before redraw() has been called.
+ redraw();
break;
}
}
Modified: scummvm/trunk/gui/newgui.h
===================================================================
--- scummvm/trunk/gui/newgui.h 2006-06-03 09:43:10 UTC (rev 22859)
+++ scummvm/trunk/gui/newgui.h 2006-06-03 10:48:37 UTC (rev 22860)
@@ -120,6 +120,8 @@
void openDialog(Dialog *dialog);
void closeTopDialog();
+ void redraw();
+
void loop();
void animateCursor();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list