[Scummvm-tracker] [ScummVM :: Bugs] #14741: GRAPHICS: MACGUI: Slowdown in Macintosh menu when moving cursor over menu bar
ScummVM :: Bugs
trac at scummvm.org
Thu Dec 14 08:03:51 UTC 2023
#14741: GRAPHICS: MACGUI: Slowdown in Macintosh menu when moving cursor over menu
bar
-------------------------+-----------------------
Reporter: eriktorbjorn | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Graphics
Version: | Resolution:
Keywords: | Game:
-------------------------+-----------------------
Comment (by eriktorbjorn):
I'm at a computer where I cant reproduce the problem right now (maybe
compiling ScummVM in Linux, running in Windows 10 isn't the ideal test
environment! :-), but my theory is that the problem happens because the
recursion depth easily reaches dozens or even hundreds of levels.
When that call stack unwinds, MacMenu::eventLoop() probably ends up
calling delayMillis(10) once for each level.
I won't be able to test it until tomorrow, but perhaps we could simply
move the call to eventLoop() a bit:
{{{
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index ab5fa3a81be..7507bc4641d 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1285,16 +1285,6 @@ bool MacMenu::mouseClick(int x, int y) {
_wm->activateMenu();
setActive(true);
-
- if (_wm->_mode & kWMModalMenuMode) {
- draw(_wm->_screen);
- eventLoop();
-
- // Do not do full refresh as we took care of
restoring
- // the screen. WM is not even aware we were
drawing.
- _wm->setFullRefresh(false);
- }
-
return true;
}
diff --git a/graphics/macgui/macwindowmanager.cpp
b/graphics/macgui/macwindowmanager.cpp
index c039bed5d30..4e1d4d3c6d1 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -1058,8 +1058,18 @@ bool MacWindowManager::processEvent(Common::Event
&event) {
}
// Menu gets events first for shortcuts and menu bar
- if (_menu && _menu->processEvent(event))
+ if (_menu && _menu->processEvent(event)) {
+ if (_mode & kWMModalMenuMode) {
+ _menu->draw(_screen);
+ _menu->eventLoop();
+
+ // Do not do full refresh as we took care of
restoring
+ // the screen. WM is not even aware we were
drawing.
+ setFullRefresh(false);
+ }
+
return true;
+ }
if (_activeWindow != -1) {
if ((_windows[_activeWindow]->isEditable() &&
_windows[_activeWindow]->getType() == kWindowWindow &&
}}}
I won't be able to test that until tomorrow at the earliest, though. And I
still don't know exactly what effect `kWMModalMenuMode` is supposed to
have.
--
Ticket URL: <https://bugs.scummvm.org/ticket/14741#comment:5>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list