[Scummvm-cvs-logs] SF.net SVN: scummvm: [32642] scummvm/branches/gsoc2008-rtl

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Tue Jun 10 01:15:18 CEST 2008


Revision: 32642
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32642&view=rev
Author:   cpage88
Date:     2008-06-09 16:15:17 -0700 (Mon, 09 Jun 2008)

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

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/graphics/cursorman.cpp
    scummvm/branches/gsoc2008-rtl/graphics/cursorman.h
    scummvm/branches/gsoc2008-rtl/gui/newgui.cpp

Modified: scummvm/branches/gsoc2008-rtl/graphics/cursorman.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/graphics/cursorman.cpp	2008-06-09 22:26:05 UTC (rev 32641)
+++ scummvm/branches/gsoc2008-rtl/graphics/cursorman.cpp	2008-06-09 23:15:17 UTC (rev 32642)
@@ -83,6 +83,24 @@
 	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);

Modified: scummvm/branches/gsoc2008-rtl/graphics/cursorman.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/graphics/cursorman.h	2008-06-09 22:26:05 UTC (rev 32641)
+++ scummvm/branches/gsoc2008-rtl/graphics/cursorman.h	2008-06-09 23:15:17 UTC (rev 32642)
@@ -80,6 +80,14 @@
 	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.
 	 *
 	 * @param disable

Modified: scummvm/branches/gsoc2008-rtl/gui/newgui.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/gui/newgui.cpp	2008-06-09 22:26:05 UTC (rev 32641)
+++ scummvm/branches/gsoc2008-rtl/gui/newgui.cpp	2008-06-09 23:15:17 UTC (rev 32642)
@@ -364,7 +364,9 @@
 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.


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