fix: revert gamescope patch 0113 now that games run on their own Xwayland (#372)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-07 06:25:06 -04:00
1 parent ef38c975b9
commit bf17ce1151
5 files changed
+5 -116

No files matched your search

+1 -1
View File
@@ -210,7 +210,7 @@ jobs:
done
if [ -f tools/gamescope/release.env ]; then
. tools/gamescope/release.env
gh release download "${GAMESCOPE_TAG}" -R "${GITHUB_REPOSITORY}" -p gamescope.tzst -O gamescope.tzst
gh release download "${GAMESCOPE_TAG}" -R "${GAMESCOPE_REPO:-${GITHUB_REPOSITORY}}" -p gamescope.tzst -O gamescope.tzst
echo "${GAMESCOPE_SHA256} gamescope.tzst" | sha256sum -c -
tar --use-compress-program=unzstd -xf gamescope.tzst -C "$D"
test -f "$D/usr/local/bin/gamescope"
+1 -1
View File
@@ -220,7 +220,7 @@ cached() {
if [[ -f "${repo_root}/tools/gamescope/release.env" ]]; then
. "${repo_root}/tools/gamescope/release.env"
gamescope_archive=$(cached "${GAMESCOPE_SHA256}" gamescope.tzst \
bash -c 'gh release download "$0" -R "$1" -p gamescope.tzst -O "$out"' "${GAMESCOPE_TAG}" "${github_repo}")
bash -c 'gh release download "$0" -R "$1" -p gamescope.tzst -O "$out"' "${GAMESCOPE_TAG}" "${GAMESCOPE_REPO:-${github_repo}}")
zstd -dc "${gamescope_archive}" | tar -xf - -C "${linuxfs_dir}"
test -f "${linuxfs_dir}/usr/local/bin/gamescope"
fi
-8
View File
@@ -39,13 +39,5 @@ library list, before anything is published.
then focus is handed over again. `GAMESCOPE_RESTORE_FOCUS_WINDOW` on the root window asks for the
same restore from outside (the session script's resume watcher).
- `0113-steam-overlay-keeps-game-keyboard-focus.patch` - this app: the Steam client opens the Quick
Access Menu and Steam menu over a game with `STEAM_INPUT_FOCUS` 1, which moves X keyboard focus to
its overlay; wine then deactivates the game and a fullscreen game minimizes itself, freezing
behind the menu instead of running on as on a Steam Deck. Steam's own overlay taking input now
keeps keyboard focus on the game, as mode 2 does; its input comes from the controller through
Steam Input, not the X keyboard. The pointer warps gamescope makes as input moves to Steam and
back are skipped around it, since the game - still taking input - saw them as a mouse jump.
Sixteen more of Armada's patches are DRM/lease/HDR-on-KMS work for a native display, which this
app's Wayland-hosted gamescope never reaches, or need a newer gamescope than the runtime has.
@@ -1,104 +0,0 @@
From: DroidDeck
Subject: [PATCH] steamcompmgr: keep the game's keyboard focus under Steam's overlay
The Steam client opens its Quick Access Menu and Steam menu over a game by setting
STEAM_OVERLAY 1 and STEAM_INPUT_FOCUS 1 on its window. Mode 1 moves X keyboard focus to the
overlay, so the game's window gets FocusOut: wine moves the foreground to the desktop, a fullscreen
game deactivates and minimizes itself (WM_CHANGE_STATE IconicState), and it stops rendering behind
the menu - frozen, all threads asleep, until the menu closes (Alan Wake's American Nightmare,
Proton Experimental ARM64). On a Steam Deck the game runs on behind the menu.
Mode 2 already means "input to the overlay, keyboard focus stays on the focus window". Treat
Steam's own overlay taking input in mode 1 the same way at the three places mode 2 is honoured.
The overlay's input does not need X keyboard focus: the controller drives it through Steam Input.
Measured by rewriting the property to 2 by hand: the game kept running behind the menu and the
controller still moved only the menu.
With the game keeping focus, the pointer resets gamescope makes when input moves to Steam (warp
to the centre, park in the corner) and back (warp to the centre) reached it as a sudden mouse
move: a mouse-look camera spun every time the menu opened and closed. Skip them while Steam's
overlay opens over a game that keeps focus, and as it closes - by then the overlay has dropped its
STEAM_INPUT_FOCUS, so whether the opening kept focus is remembered.
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
index 372a82c..3fab3c6 100644
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -1321,6 +1321,22 @@ window_is_steam( steamcompmgr_win_t *w )
return w && ( w->isSteamLegacyBigPicture || w->appID == 769 );
}
+// Whether keyboard focus stays on the focus window while this window has input focus.
+// STEAM_INPUT_FOCUS 2 asks for that. The Steam client also opens its Quick Access Menu and Steam
+// menu over a game with 1, which moves X keyboard focus to the overlay: wine then deactivates the
+// game, a fullscreen game minimizes itself, and it froze behind the menu instead of running on as
+// on a Steam Deck. The overlay's own input does not need X keyboard focus (the controller drives
+// it through Steam Input), so Steam's overlay keeps the game's keyboard focus too.
+static bool
+window_keeps_game_keyboard_focus( steamcompmgr_win_t *w )
+{
+ if ( !w )
+ return false;
+ if ( w->inputFocusMode == 2 )
+ return true;
+ return w->inputFocusMode == 1 && w->isOverlay && window_is_steam( w );
+}
+
static bool
window_is_vr_scene_app( steamcompmgr_win_t *w )
{
@@ -4728,7 +4744,7 @@ void xwayland_ctx_t::DetermineAndApplyFocus( const std::vector< steamcompmgr_win
if ( gamescope::VirtualConnectorIsSingleOutput() )
{
- if ( inputFocus && inputFocus->inputFocusMode == 2 )
+ if ( window_keeps_game_keyboard_focus( inputFocus ) )
keyboardFocusWin = ctx->focus.focusWindow;
}
else
@@ -4834,12 +4850,26 @@ void xwayland_ctx_t::DetermineAndApplyFocus( const std::vector< steamcompmgr_win
if ( ctx->focus.inputFocusWindow != inputFocus ||
ctx->focus.inputFocusMode != inputFocus->inputFocusMode )
{
+ // Steam's overlay opening over a game, or closing again, while the game keeps keyboard focus
+ // (window_keeps_game_keyboard_focus): the game is still taking input, so a pointer warp
+ // reaches it as a sudden mouse move - the camera of a mouse-look game spun as the Quick
+ // Access Menu opened and as it closed. The overlay is driven by the controller and the
+ // cursor is hidden, so leave the pointer where it is. Closing, the overlay has already
+ // dropped its STEAM_INPUT_FOCUS, so whether the opening kept focus is remembered.
+ static bool s_bOverlayKeptGameFocus = false;
+ bool bOverlayKeepsGameFocus = window_keeps_game_keyboard_focus( inputFocus ) &&
+ ctx->focus.focusWindow && !window_is_steam( ctx->focus.focusWindow );
+ bool bSkipPointerReset = bOverlayKeepsGameFocus || s_bOverlayKeptGameFocus;
+ s_bOverlayKeptGameFocus = bOverlayKeepsGameFocus;
+
// If the window doesn't want focus when hidden, move it away
// as we are going to hide it straight after.
// otherwise, if we switch from wanting it to not
// (steam -> game)
// put us back in the centre of the screen.
- if (window_wants_no_focus_when_mouse_hidden(inputFocus))
+ if ( bSkipPointerReset )
+ ;
+ else if (window_wants_no_focus_when_mouse_hidden(inputFocus))
ctx->focus.bResetToCorner = true;
else if ( window_wants_no_focus_when_mouse_hidden(inputFocus) != window_wants_no_focus_when_mouse_hidden(ctx->focus.inputFocusWindow) )
ctx->focus.bResetToCenter = true;
@@ -5340,7 +5370,7 @@ determine_and_apply_focus( global_focus_t *pFocus )
pFocus->inputFocusMode = pFocus->inputFocusWindow->inputFocusMode;
if ( gamescope::VirtualConnectorIsSingleOutput() &&
- pFocus->inputFocusMode == 2 )
+ window_keeps_game_keyboard_focus( pFocus->inputFocusWindow ) )
{
pFocus->keyboardFocusWindow = pFocus->overrideWindow
? pFocus->overrideWindow
@@ -6485,7 +6515,7 @@ handle_wl_surface_id(xwayland_ctx_t *ctx, steamcompmgr_win_t *w, uint32_t surfac
steamcompmgr_win_t *keyboardFocusWindow = pCurrentFocus->inputFocusWindow;
if ( gamescope::VirtualConnectorIsSingleOutput() &&
- keyboardFocusWindow && keyboardFocusWindow->inputFocusMode == 2 )
+ window_keeps_game_keyboard_focus( keyboardFocusWindow ) )
keyboardFocusWindow = pCurrentFocus->focusWindow;
if ( w == keyboardFocusWindow )
+3 -2
View File
@@ -1,2 +1,3 @@
GAMESCOPE_TAG=gamescope-3.16.29-p5
GAMESCOPE_SHA256=188144e5564e020d0bc485a1f4f90e1c5fd61d0d1d6dd29db21e8b019036a5c6
GAMESCOPE_REPO=Droid-Deck/DroidDeck-Components
GAMESCOPE_TAG=gamescope-3.16.29-p8
GAMESCOPE_SHA256=65fcc17af1aee4944a42ce1e688db61ceb10db5f299f0de75e338f56646e2953