From 8062eb6ec33e32012da28f0cd06b8f9334c26937 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 25 May 2006 22:51:42 +0000 Subject: Set and show/hide mouse cursors through a "cursor manager" (analogous to the recently added (cursor) palette manager) so that the cursor can be properly restored after returning from the GUI. If there's any C++ magic that can keep the backend functions from being called by anything else than these managing classes, that would probably be a good idea. Also, since the cursor manager keeps a copy of the cursor image, perhaps there are at least some backends that will no longer need to? svn-id: r22639 --- gui/ThemeNew.cpp | 3 ++- gui/newgui.cpp | 8 ++++---- gui/newgui.h | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gui') diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp index 0ff6b45fa4..ca50e5d11a 100644 --- a/gui/ThemeNew.cpp +++ b/gui/ThemeNew.cpp @@ -27,6 +27,7 @@ #include "graphics/imageman.h" #include "graphics/imagedec.h" #include "graphics/colormasks.h" +#include "graphics/cursorman.h" #include "graphics/paletteman.h" #include "common/config-manager.h" @@ -1549,7 +1550,7 @@ OverlayColor ThemeNew::calcDimColor(OverlayColor col) { void ThemeNew::setUpCursor() { PaletteMan.pushCursorPalette(_cursorPal, 0, MAX_CURS_COLORS); - _system->setMouseCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale); + CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale); } void ThemeNew::createCursor() { diff --git a/gui/newgui.cpp b/gui/newgui.cpp index db45d94e3c..f0d58d8982 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -22,6 +22,7 @@ #include "common/stdafx.h" #include "common/system.h" #include "common/util.h" +#include "graphics/cursorman.h" #include "graphics/paletteman.h" #include "gui/newgui.h" #include "gui/dialog.h" @@ -156,6 +157,7 @@ void NewGui::runLoop() { }; PaletteMan.pushCursorPalette(palette, 0, 4); + CursorMan.pushCursor(NULL, 0, 0, 0, 0); } while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) { @@ -286,8 +288,6 @@ void NewGui::runLoop() { void NewGui::saveState() { // Backup old cursor - _oldCursorMode = _system->showMouse(true); - _currentKeyDown.keycode = 0; _lastClick.x = _lastClick.y = 0; _lastClick.time = 0; @@ -297,7 +297,7 @@ void NewGui::saveState() { } void NewGui::restoreState() { - _system->showMouse(_oldCursorMode); + CursorMan.popCursor(); _system->updateScreen(); @@ -333,7 +333,7 @@ void NewGui::animateCursor() { } } - _system->setMouseCursor(_cursor, 16, 16, 7, 7); + CursorMan.replaceCursor(_cursor, 16, 16, 7, 7); _cursorAnimateTimer = time; _cursorAnimateCounter = (_cursorAnimateCounter + 1) % 4; diff --git a/gui/newgui.h b/gui/newgui.h index 58bdf4715b..055f616131 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -107,7 +107,6 @@ protected: } _lastClick; // mouse cursor state - bool _oldCursorMode; int _cursorAnimateCounter; int _cursorAnimateTimer; byte _cursor[2048]; -- cgit v1.2.3