Maelstrom: Don't pop up the gamepad keyboard when streaming to a phone or tablet

From 714daa88c1d43ba3384ab6e1792f575a8d8be742 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 29 Mar 2026 08:49:44 -0700
Subject: [PATCH] Don't pop up the gamepad keyboard when streaming to a phone
 or tablet

---
 screenlib/SDL_FrameBuf.cpp | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/screenlib/SDL_FrameBuf.cpp b/screenlib/SDL_FrameBuf.cpp
index 4bd1c6af..8f4c1979 100644
--- a/screenlib/SDL_FrameBuf.cpp
+++ b/screenlib/SDL_FrameBuf.cpp
@@ -341,7 +341,27 @@ FrameBuf::EnableTextInput(int textfieldX, int textfieldY, int textfieldWidth, in
 #ifdef ENABLE_STEAM
 	ISteamUtils *pSteamUtils = SteamUtils();
 	if (pSteamUtils) {
-		pSteamUtils->ShowFloatingGamepadTextInput(k_EFloatingGamepadTextInputModeModeSingleLine, textrect.x, textrect.y, textrect.w, textrect.h);
+		// Don't show the gamepad input when streaming to a phone or tablet
+		bool bStreamingToPhoneOrTablet = false;
+		ISteamRemotePlay *pSteamRemotePlay = SteamRemotePlay();
+		for (uint32 i = 0; i < pSteamRemotePlay->GetSessionCount(); ++i) {
+			RemotePlaySessionID_t sessionID = pSteamRemotePlay->GetSessionID(i);
+
+			// Skip Remote Play Together sessions
+			if (pSteamRemotePlay->BSessionRemotePlayTogether(sessionID)) {
+				continue;
+			}
+
+			ESteamDeviceFormFactor eFormFactor = pSteamRemotePlay->GetSessionClientFormFactor(sessionID);
+			if (eFormFactor == k_ESteamDeviceFormFactorPhone || 
+				eFormFactor == k_ESteamDeviceFormFactorTablet) {
+				bStreamingToPhoneOrTablet = true;
+				break;
+			}
+		}
+		if (!bStreamingToPhoneOrTablet) {
+			pSteamUtils->ShowFloatingGamepadTextInput(k_EFloatingGamepadTextInputModeModeSingleLine, textrect.x, textrect.y, textrect.w, textrect.h);
+		}
 	}
 #endif