diff --git a/engines/pink/screen.cpp b/engines/pink/screen.cpp index 583afccc1a3..b28c1fb7de3 100644 --- a/engines/pink/screen.cpp +++ b/engines/pink/screen.cpp @@ -102,7 +102,7 @@ Screen::Screen(PinkEngine *vm) _wm->setScreen(&_surface); _wm->setMenuHotzone(Common::Rect(0, 0, 640, 23)); - _wm->setMenuDelay(250000); + _wm->setMenuDelay(250); _wm->setEngineRedrawCallback(this, redrawCallback); _textFont = nullptr; diff --git a/engines/scumm/macgui/macgui_impl.cpp b/engines/scumm/macgui/macgui_impl.cpp index bef2520f1f7..a22084d3142 100644 --- a/engines/scumm/macgui/macgui_impl.cpp +++ b/engines/scumm/macgui/macgui_impl.cpp @@ -156,7 +156,7 @@ void MacGuiImpl::initialize() { if (_vm->isUsingOriginalGUI()) { _windowManager->setMenuHotzone(Common::Rect(640, 23)); - _windowManager->setMenuDelay(250000); + _windowManager->setMenuDelay(250); Common::MacResManager resource; Graphics::MacMenu *menu = _windowManager->addMenu(); diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp index 3d333839b6b..bfdb959b7c5 100644 --- a/graphics/macgui/macwindowmanager.cpp +++ b/graphics/macgui/macwindowmanager.cpp @@ -21,7 +21,6 @@ #include "common/array.h" #include "common/list.h" #include "common/system.h" -#include "common/timer.h" #include "graphics/cursorman.h" #include "graphics/managed_surface.h" @@ -152,8 +151,6 @@ static const byte macCursorCrossBar[] = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, }; -static void menuTimerHandler(void *refCon); - MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns, Common::Language language) { _screen = nullptr; _screenCopy = nullptr; @@ -175,7 +172,7 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns, Common::L _menu = 0; _menuDelay = 0; - _menuTimerActive = false; + _menuTimer = 0; _engineP = nullptr; _engineR = nullptr; @@ -258,8 +255,6 @@ MacWindowManager::~MacWindowManager() { cleanupDesktopBmp(); cleanupDataBundle(); - - g_system->getTimerManager()->removeTimerProc(&menuTimerHandler); } void MacWindowManager::setDesktopMode(uint32 mode) { @@ -999,6 +994,14 @@ void MacWindowManager::draw() { } } + if (_menuTimer && g_system->getMillis() >= _menuTimer) { + if (_menuHotzone.contains(_lastMousePos)) { + activateMenu(); + } + + _menuTimer = 0; + } + // Menu is drawn on top of everything and always if (_menu && !(_mode & kWMModeFullscreen)) { if (_fullRefresh) @@ -1019,18 +1022,6 @@ void MacWindowManager::draw() { _fullRefresh = false; } -static void menuTimerHandler(void *refCon) { - MacWindowManager *wm = (MacWindowManager *)refCon; - - if (wm->_menuHotzone.contains(wm->_lastMousePos)) { - wm->activateMenu(); - } - - wm->_menuTimerActive = false; - - g_system->getTimerManager()->removeTimerProc(&menuTimerHandler); -} - bool MacWindowManager::processEvent(Common::Event &event) { switch (event.type) { case Common::EVENT_MOUSEMOVE: @@ -1049,10 +1040,8 @@ bool MacWindowManager::processEvent(Common::Event &event) { if (_menu && !_menu->isVisible()) { if ((_mode & kWMModeAutohideMenu) && event.type == Common::EVENT_MOUSEMOVE) { - if (!_menuTimerActive && _menuHotzone.contains(event.mouse)) { - _menuTimerActive = true; - - g_system->getTimerManager()->installTimerProc(&menuTimerHandler, _menuDelay, this, "menuWindowCursor"); + if (!_menuTimer && _menuHotzone.contains(event.mouse)) { + _menuTimer = g_system->getMillis() + _menuDelay; } } } diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h index 22a128c77a0..902b3c485fb 100644 --- a/graphics/macgui/macwindowmanager.h +++ b/graphics/macgui/macwindowmanager.h @@ -402,7 +402,7 @@ public: Common::Point _lastMousePos; Common::Rect _menuHotzone; - bool _menuTimerActive; + uint32 _menuTimer; bool _mouseDown; uint32 _colorBlack, _colorGray80, _colorGray88, _colorGrayEE, _colorWhite, _colorGreen, _colorGreen2;