mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-02 15:16:46 +00:00
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. svn-id: r22860
This commit is contained in:
parent
3114f19d94
commit
ca84620745
@ -131,38 +131,9 @@ NewGui::NewGui() : _needRedraw(false),
|
||||
_theme->resetDrawArea();
|
||||
}
|
||||
|
||||
void NewGui::runLoop() {
|
||||
Dialog *activeDialog = _dialogStack.top();
|
||||
bool didSaveState = false;
|
||||
int button;
|
||||
|
||||
if (activeDialog == 0)
|
||||
return;
|
||||
|
||||
if (!_stateIsSaved) {
|
||||
saveState();
|
||||
_theme->enable();
|
||||
didSaveState = true;
|
||||
}
|
||||
|
||||
void NewGui::redraw() {
|
||||
int i;
|
||||
bool useStandardCurs = !_theme->ownCursor();
|
||||
|
||||
if (useStandardCurs) {
|
||||
const byte palette[] = {
|
||||
255, 255, 255, 0,
|
||||
255, 255, 255, 0,
|
||||
171, 171, 171, 0,
|
||||
87, 87, 87, 0
|
||||
};
|
||||
|
||||
PaletteMan.pushCursorPalette(palette, 0, 4);
|
||||
CursorMan.pushCursor(NULL, 0, 0, 0, 0);
|
||||
CursorMan.showMouse(true);
|
||||
}
|
||||
|
||||
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();
|
||||
@ -183,6 +154,40 @@ void NewGui::runLoop() {
|
||||
|
||||
_dialogStack[i]->drawDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void NewGui::runLoop() {
|
||||
Dialog *activeDialog = _dialogStack.top();
|
||||
bool didSaveState = false;
|
||||
int button;
|
||||
|
||||
if (activeDialog == 0)
|
||||
return;
|
||||
|
||||
if (!_stateIsSaved) {
|
||||
saveState();
|
||||
_theme->enable();
|
||||
didSaveState = true;
|
||||
}
|
||||
|
||||
bool useStandardCurs = !_theme->ownCursor();
|
||||
|
||||
if (useStandardCurs) {
|
||||
const byte palette[] = {
|
||||
255, 255, 255, 0,
|
||||
255, 255, 255, 0,
|
||||
171, 171, 171, 0,
|
||||
87, 87, 87, 0
|
||||
};
|
||||
|
||||
PaletteMan.pushCursorPalette(palette, 0, 4);
|
||||
CursorMan.pushCursor(NULL, 0, 0, 0, 0);
|
||||
CursorMan.showMouse(true);
|
||||
}
|
||||
|
||||
while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) {
|
||||
if (_needRedraw) {
|
||||
redraw();
|
||||
_needRedraw = false;
|
||||
}
|
||||
|
||||
@ -256,11 +261,14 @@ void NewGui::runLoop() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,8 @@ protected:
|
||||
void openDialog(Dialog *dialog);
|
||||
void closeTopDialog();
|
||||
|
||||
void redraw();
|
||||
|
||||
void loop();
|
||||
|
||||
void animateCursor();
|
||||
|
Loading…
Reference in New Issue
Block a user