From c48489f6d244091ac238c30760829ed675913b10 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 23 Jul 2018 14:47:46 +0200 Subject: GRAPHICS: MACGUI: Restore screen on exiting from menu --- graphics/macgui/macmenu.cpp | 4 ++++ graphics/macgui/macwindowmanager.cpp | 3 +++ graphics/macgui/macwindowmanager.h | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'graphics/macgui') diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index d48a7f47f9..cb447727c4 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -673,6 +673,8 @@ bool MacMenu::mouseMove(int x, int y) { _isVisible = false; if (_wm->_mode & kWMModalMenuMode) { _wm->pauseEngine(false); + _wm->_screen = _wm->_screenCopy; // restore screen + g_system->copyRectToScreen(_wm->_screenCopy->getBasePtr(0, 0), _wm->_screenCopy->pitch, 0, 0, _wm->_screenCopy->w, _wm->_screenCopy->h); } } @@ -686,6 +688,8 @@ bool MacMenu::mouseRelease(int x, int y) { if (_wm->_mode & kWMModalMenuMode) { _wm->pauseEngine(false); + _wm->_screen = _wm->_screenCopy; // restore screen + g_system->copyRectToScreen(_wm->_screenCopy->getBasePtr(0, 0), _wm->_screenCopy->pitch, 0, 0, _wm->_screenCopy->w, _wm->_screenCopy->h); } if (_activeItem != -1 && _activeSubItem != -1 && _items[_activeItem]->subitems[_activeSubItem]->enabled) { diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp index fea656518f..8998262b91 100644 --- a/graphics/macgui/macwindowmanager.cpp +++ b/graphics/macgui/macwindowmanager.cpp @@ -149,6 +149,7 @@ static void menuTimerHandler(void *refCon); MacWindowManager::MacWindowManager() { _screen = 0; + _screenCopy = 0; _lastId = 0; _activeWindow = -1; @@ -184,6 +185,7 @@ MacWindowManager::~MacWindowManager() { delete _windows[i]; delete _fontMan; + delete _screenCopy; g_system->getTimerManager()->removeTimerProc(&menuTimerHandler); } @@ -338,6 +340,7 @@ static void menuTimerHandler(void *refCon) { if (wm->_menuHotzone.contains(wm->_lastMousePos)) { wm->activateMenu(); if (wm->_mode & kWMModalMenuMode) { + wm->_screenCopy = new ManagedSurface(*wm->_screen); // Create a copy wm->pauseEngine(true); } } diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h index a889816d95..0a8a5a4b33 100644 --- a/graphics/macgui/macwindowmanager.h +++ b/graphics/macgui/macwindowmanager.h @@ -235,9 +235,11 @@ private: void removeFromStack(BaseMacWindow *target); void removeFromWindowList(BaseMacWindow *target); -private: +public: ManagedSurface *_screen; + ManagedSurface *_screenCopy; +private: Common::List _windowStack; Common::Array _windows; -- cgit v1.2.3