diff options
author | Max Horn | 2006-08-04 18:11:00 +0000 |
---|---|---|
committer | Max Horn | 2006-08-04 18:11:00 +0000 |
commit | aab45bac44554e0b91c4ca7193e90cbfa1a8b619 (patch) | |
tree | 75d0cdbfa3a2c97973df791458a43b01548cb742 | |
parent | 40835e42b931c96c3889448fed4f5cdd4d6704a2 (diff) | |
download | scummvm-rg350-aab45bac44554e0b91c4ca7193e90cbfa1a8b619.tar.gz scummvm-rg350-aab45bac44554e0b91c4ca7193e90cbfa1a8b619.tar.bz2 scummvm-rg350-aab45bac44554e0b91c4ca7193e90cbfa1a8b619.zip |
Only refresh the theme & reflow all dialogs if the screen settings actually changed
svn-id: r23669
-rw-r--r-- | gui/newgui.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 7854e2e7a1..385d68cc88 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -87,6 +87,7 @@ NewGui::NewGui() : _needRedraw(false), _stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0) { _system = g_system; + _lastScreenChangeID = _system->getScreenChangeID(); // Clear the cursor memset(_cursor, 0xFF, sizeof(_cursor)); @@ -257,6 +258,8 @@ void NewGui::runLoop() { _system->quit(); return; case OSystem::EVENT_SCREEN_CHANGED: + _lastScreenChangeID = _system->getScreenChangeID(); + // reinit the whole theme _theme->refresh(); // refresh all dialogs @@ -318,18 +321,22 @@ void NewGui::openDialog(Dialog *dialog) { _dialogStack.push(dialog); _needRedraw = true; - // TODO: No need to always reflow everything. Rather, we should - // check for the value of OSystem::getScreenChangeID() and - // only do a full update when that changed... - if (true) { + // We reflow the dialog just before opening it. If the screen changed + // since the last time we looked, also refresh the loaded theme, + // and reflow all other open dialogs, too. + int tmpScreenChangeID = _system->getScreenChangeID(); + if (_lastScreenChangeID != tmpScreenChangeID) { + _lastScreenChangeID = tmpScreenChangeID; + // reinit the whole theme _theme->refresh(); // refresh all dialogs for (int i = 0; i < _dialogStack.size(); ++i) { _dialogStack[i]->reflowLayout(); } - } else + } else { dialog->reflowLayout(); + } } void NewGui::closeTopDialog() { |