Maelstrom: Don't toggle fullscreen if Alt and Return are used for controls

From 2ac83a40170211e7488fb13c12a66284d79fd114 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 3 Apr 2026 10:43:05 -0700
Subject: [PATCH] Don't toggle fullscreen if Alt and Return are used for
 controls

---
 game/controls.cpp | 58 +++++++++++++++++++++++++++++++----------------
 game/controls.h   |  2 ++
 2 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/game/controls.cpp b/game/controls.cpp
index c7ec3d77..f52138d6 100644
--- a/game/controls.cpp
+++ b/game/controls.cpp
@@ -55,6 +55,22 @@ Controls::Bind(Prefs *prefs)
 	gQuitControl.Bind(prefs);
 }
 
+bool
+Controls::KeyBound(SDL_Keycode key)
+{
+	if (key == gPauseControl ||
+	    key == gShieldControl ||
+	    key == gThrustControl ||
+	    key == gBrakeControl ||
+	    key == gTurnRControl ||
+	    key == gTurnLControl ||
+	    key == gFireControl ||
+	    key == gQuitControl) {
+		return true;
+	}
+	return false;
+}
+
 Controls controls;
 PrefsVariable<int> gSoundLevel("SoundLevel", 4);
 PrefsVariable<int> gGammaCorrect("GammaCorrect", 3);
@@ -588,26 +604,28 @@ void HandleEvent(SDL_Event *event)
 			key = event->key.key;
 
 			/* -- Handle special control keys */
-			if ( key == SDLK_F1 ) {
-				/* Special key --
-					Switch displayed player
-				 */
-				RotatePlayerView();
-				break;
-			} else if ( key == SDLK_F3 ) {
-				/* Special key --
-					Do a screen dump here.
-				 */
-				screen->ScreenDump("ScreenShot",
-							0, 0, 0, 0);
-				break;
-			} else if ( key == SDLK_RETURN &&
-				    (event->key.mod & SDL_KMOD_ALT) ) {
-				/* Special key --
-					Toggle fullscreen mode
-				 */
-				screen->ToggleFullScreen();
-				break;
+			if (!controls.KeyBound(key)) {
+				if ( key == SDLK_F1 ) {
+					/* Special key --
+						Switch displayed player
+					 */
+					RotatePlayerView();
+					break;
+				} else if ( key == SDLK_F3 ) {
+					/* Special key --
+						Do a screen dump here.
+					 */
+					screen->ScreenDump("ScreenShot",
+								0, 0, 0, 0);
+					break;
+				} else if ( key == SDLK_RETURN &&
+						(event->key.mod & SDL_KMOD_ALT) ) {
+					/* Special key --
+						Toggle fullscreen mode
+					 */
+					screen->ToggleFullScreen();
+					break;
+				}
 			} else if ( key == controls.gPauseControl ) {
 				gGameInfo.TogglePauseRequest();
 				break;
diff --git a/game/controls.h b/game/controls.h
index caa1a549..04ebccc4 100644
--- a/game/controls.h
+++ b/game/controls.h
@@ -53,6 +53,8 @@ class Controls
 
 	void Bind(Prefs *prefs);
 
+	bool KeyBound(SDL_Keycode key);
+
 public:
 	PrefsVariable<SDL_Keycode> gPauseControl;
 	PrefsVariable<SDL_Keycode> gShieldControl;