[Scummvm-git-logs] scummvm branch-2-8 -> 5871f2fa8296e2534ff1b20cf9bff677cfb07a94

eriktorbjorn noreply at scummvm.org
Mon Dec 18 19:23:39 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5b82fc6f97 SCUMM: Fix Mac GUI screen corruption when using menu shortcuts
5871f2fa82 NEWS: Mention Mac GUI fix for 2.8.1, assuming there is one.


Commit: 5b82fc6f976c4231fd186b7e2965dafc70811b12
    https://github.com/scummvm/scummvm/commit/5b82fc6f976c4231fd186b7e2965dafc70811b12
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-18T20:20:15+01:00

Commit Message:
SCUMM: Fix Mac GUI screen corruption when using menu shortcuts

I think the problem was that a stale copy of the desktop image was being
used because of the way we force the menu to stay open during dialogs.
Maybe a better fix can be found later, but this will do for now. Please
don't merge to master, because I have a work-in-progress restructuring
of the Mac GUI code in another branch, so I'll make the change there
instead.

Changed paths:
    engines/scumm/gfx_mac.cpp
    engines/scumm/gfx_mac.h


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index 806f650dd42..41a4d835624 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -2561,7 +2561,14 @@ int MacGui::delay(uint32 ms) {
 // --------------------------------------------------------------------------
 
 void MacGui::menuCallback(int id, Common::String &name, void *data) {
-	((MacGui *)data)->handleMenu(id, name);
+	MacGui *gui = (MacGui *)data;
+
+	gui->handleMenu(id, name);
+
+	if (gui->_forceMenuClosed) {
+		gui->_windowManager->getMenu()->closeMenu();
+		gui->_forceMenuClosed = false;
+	}
 }
 
 void MacGui::initialize() {
@@ -2668,6 +2675,17 @@ bool MacGui::handleMenu(int id, Common::String &name) {
 
 	// This is how we keep the menu bar visible.
 	Graphics::MacMenu *menu = _windowManager->getMenu();
+
+	// If the menu is opened through a shortcut key, force it to activate
+	// to avoid screen corruption. In that case, we also force the menu to
+	// close afterwards, or the game will stay paused. Which is
+	// particularly bad during a restart.
+
+	if (!menu->_active) {
+		_windowManager->activateMenu();
+		_forceMenuClosed = true;
+	}
+
 	menu->closeMenu();
 	menu->setActive(true);
 	menu->setVisible(true);
@@ -2676,10 +2694,12 @@ bool MacGui::handleMenu(int id, Common::String &name) {
 	int saveSlotToHandle = -1;
 	Common::String savegameName;
 
+	bool result = true;
+
 	switch (id) {
 	case 100:	// About
 		runAboutDialog();
-		return true;
+		break;
 
 	case 200:	// Open
 		if (runOpenDialog(saveSlotToHandle)) {
@@ -2690,7 +2710,7 @@ bool MacGui::handleMenu(int id, Common::String &name) {
 			}
 		}
 
-		return true;
+		break;
 
 	case 201:	// Save
 		if (runSaveDialog(saveSlotToHandle, savegameName)) {
@@ -2699,17 +2719,17 @@ bool MacGui::handleMenu(int id, Common::String &name) {
 			}
 		}
 
-		return true;
+		break;
 
 	case 202:	// Restart
 		if (runRestartDialog())
 			_vm->restart();
-		return true;
+		break;
 
 	case 203:	// Pause
 		if (!_vm->_messageBannerActive)
 			_vm->mac_showOldStyleBannerAndPause(_vm->getGUIString(gsPause), -1);
-		return true;
+		break;
 
 	// In the original, the Edit menu is active during save dialogs, though
 	// only Cut, Copy and Paste.
@@ -2719,10 +2739,14 @@ bool MacGui::handleMenu(int id, Common::String &name) {
 	case 302:	// Copy
 	case 303:	// Paste
 	case 304:	// Clear
-		return true;
+		break;
+
+	default:
+		result = false;
+		break;
 	}
 
-	return false;
+	return result;
 }
 
 void MacGui::updateWindowManager() {
diff --git a/engines/scumm/gfx_mac.h b/engines/scumm/gfx_mac.h
index a7142ab09ed..29c0ca5d067 100644
--- a/engines/scumm/gfx_mac.h
+++ b/engines/scumm/gfx_mac.h
@@ -41,7 +41,6 @@ protected:
 	ScummEngine *_vm = nullptr;
 	OSystem *_system = nullptr;
 
-	Graphics::MacWindowManager *_windowManager = nullptr;
 	Graphics::Surface *_surface = nullptr;
 	Common::String _resourceFile;
 
@@ -575,6 +574,9 @@ public:
 	MacGui(ScummEngine *vm, Common::String resourceFile);
 	virtual ~MacGui();
 
+	Graphics::MacWindowManager *_windowManager = nullptr;
+	bool _forceMenuClosed = false;
+
 	Graphics::Surface *surface() { return _surface; }
 
 	virtual const Common::String name() const = 0;


Commit: 5871f2fa8296e2534ff1b20cf9bff677cfb07a94
    https://github.com/scummvm/scummvm/commit/5871f2fa8296e2534ff1b20cf9bff677cfb07a94
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-18T20:23:13+01:00

Commit Message:
NEWS: Mention Mac GUI fix for 2.8.1, assuming there is one.

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index 969f7b41aa8..b8a4e8961ee 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,12 @@
 For a more comprehensive changelog of the latest experimental code, see:
         https://github.com/scummvm/scummvm/commits/
 
+#### 2.8.1 (????-??-??)
+
+ SCUMM:
+   - Fix screen corruption (and sometimes even crashes) in Mac Loom and
+     Indiana Jones and the Last Crusade when using menu shortcut keys.
+
 #### 2.8.0 (2023-12-30)
 
  New games:




More information about the Scummvm-git-logs mailing list