Ticket #15006: macgui_menu_corruption3.txt

File macgui_menu_corruption3.txt, 3.9 KB (added by eriktorbjorn, 2 months ago)
Line 
1diff --git a/engines/pink/screen.cpp b/engines/pink/screen.cpp
2index 583afccc1a3..b28c1fb7de3 100644
3--- a/engines/pink/screen.cpp
4+++ b/engines/pink/screen.cpp
5@@ -102,7 +102,7 @@ Screen::Screen(PinkEngine *vm)
6
7 _wm->setScreen(&_surface);
8 _wm->setMenuHotzone(Common::Rect(0, 0, 640, 23));
9- _wm->setMenuDelay(250000);
10+ _wm->setMenuDelay(250);
11 _wm->setEngineRedrawCallback(this, redrawCallback);
12
13 _textFont = nullptr;
14diff --git a/engines/scumm/macgui/macgui_impl.cpp b/engines/scumm/macgui/macgui_impl.cpp
15index bef2520f1f7..a22084d3142 100644
16--- a/engines/scumm/macgui/macgui_impl.cpp
17+++ b/engines/scumm/macgui/macgui_impl.cpp
18@@ -156,7 +156,7 @@ void MacGuiImpl::initialize() {
19
20 if (_vm->isUsingOriginalGUI()) {
21 _windowManager->setMenuHotzone(Common::Rect(640, 23));
22- _windowManager->setMenuDelay(250000);
23+ _windowManager->setMenuDelay(250);
24
25 Common::MacResManager resource;
26 Graphics::MacMenu *menu = _windowManager->addMenu();
27diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
28index 3d333839b6b..bfdb959b7c5 100644
29--- a/graphics/macgui/macwindowmanager.cpp
30+++ b/graphics/macgui/macwindowmanager.cpp
31@@ -21,7 +21,6 @@
32 #include "common/array.h"
33 #include "common/list.h"
34 #include "common/system.h"
35-#include "common/timer.h"
36
37 #include "graphics/cursorman.h"
38 #include "graphics/managed_surface.h"
39@@ -152,8 +151,6 @@ static const byte macCursorCrossBar[] = {
40 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
41 };
42
43-static void menuTimerHandler(void *refCon);
44-
45 MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns, Common::Language language) {
46 _screen = nullptr;
47 _screenCopy = nullptr;
48@@ -175,7 +172,7 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns, Common::L
49
50 _menu = 0;
51 _menuDelay = 0;
52- _menuTimerActive = false;
53+ _menuTimer = 0;
54
55 _engineP = nullptr;
56 _engineR = nullptr;
57@@ -258,8 +255,6 @@ MacWindowManager::~MacWindowManager() {
58
59 cleanupDesktopBmp();
60 cleanupDataBundle();
61-
62- g_system->getTimerManager()->removeTimerProc(&menuTimerHandler);
63 }
64
65 void MacWindowManager::setDesktopMode(uint32 mode) {
66@@ -999,6 +994,14 @@ void MacWindowManager::draw() {
67 }
68 }
69
70+ if (_menuTimer && g_system->getMillis() >= _menuTimer) {
71+ if (_menuHotzone.contains(_lastMousePos)) {
72+ activateMenu();
73+ }
74+
75+ _menuTimer = 0;
76+ }
77+
78 // Menu is drawn on top of everything and always
79 if (_menu && !(_mode & kWMModeFullscreen)) {
80 if (_fullRefresh)
81@@ -1019,18 +1022,6 @@ void MacWindowManager::draw() {
82 _fullRefresh = false;
83 }
84
85-static void menuTimerHandler(void *refCon) {
86- MacWindowManager *wm = (MacWindowManager *)refCon;
87-
88- if (wm->_menuHotzone.contains(wm->_lastMousePos)) {
89- wm->activateMenu();
90- }
91-
92- wm->_menuTimerActive = false;
93-
94- g_system->getTimerManager()->removeTimerProc(&menuTimerHandler);
95-}
96-
97 bool MacWindowManager::processEvent(Common::Event &event) {
98 switch (event.type) {
99 case Common::EVENT_MOUSEMOVE:
100@@ -1049,10 +1040,8 @@ bool MacWindowManager::processEvent(Common::Event &event) {
101
102 if (_menu && !_menu->isVisible()) {
103 if ((_mode & kWMModeAutohideMenu) && event.type == Common::EVENT_MOUSEMOVE) {
104- if (!_menuTimerActive && _menuHotzone.contains(event.mouse)) {
105- _menuTimerActive = true;
106-
107- g_system->getTimerManager()->installTimerProc(&menuTimerHandler, _menuDelay, this, "menuWindowCursor");
108+ if (!_menuTimer && _menuHotzone.contains(event.mouse)) {
109+ _menuTimer = g_system->getMillis() + _menuDelay;
110 }
111 }
112 }
113diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
114index 22a128c77a0..902b3c485fb 100644
115--- a/graphics/macgui/macwindowmanager.h
116+++ b/graphics/macgui/macwindowmanager.h
117@@ -402,7 +402,7 @@ public:
118 Common::Point _lastMousePos;
119 Common::Rect _menuHotzone;
120
121- bool _menuTimerActive;
122+ uint32 _menuTimer;
123 bool _mouseDown;
124
125 uint32 _colorBlack, _colorGray80, _colorGray88, _colorGrayEE, _colorWhite, _colorGreen, _colorGreen2;