Implemented popAllCursors() in CursorManager to ensure that all unnecessary cursors are removed from the cursor stack when returning to the launcher

svn-id: r32642
This commit is contained in:
Christopher Page 2008-06-09 23:15:17 +00:00
parent 4d7798825c
commit 4fddafa3e6
3 changed files with 29 additions and 1 deletions

View File

@ -83,6 +83,24 @@ void CursorManager::popCursor() {
g_system->showMouse(isVisible());
}
void CursorManager::popAllCursors() {
while (!_cursorStack.empty()) {
Cursor *cur = _cursorStack.pop();
delete cur;
}
if (g_system->hasFeature(OSystem::kFeatureCursorHasPalette)) {
while (!_cursorPaletteStack.empty()) {
Palette *pal = _cursorPaletteStack.pop();
delete pal;
}
}
g_system->showMouse(isVisible());
}
void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int targetScale) {
if (_cursorStack.empty()) {
pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale);

View File

@ -79,6 +79,14 @@ public:
*/
void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetScale = 1);
/**
* Pop all of the cursors and cursor palettes from their respective stacks.
* The purpose is to ensure that all unecessary cursors are removed from the
* stack when returning to the launcher from an engine.
*
*/
void popAllCursors();
/**
* Enable/Disable the current cursor palette.
*

View File

@ -364,7 +364,9 @@ void NewGui::restoreState() {
void NewGui::openDialog(Dialog *dialog) {
_dialogStack.push(dialog);
_needRedraw = true;
CursorMan.popAllCursors();
// 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.