From 82ad9330d0f90767bfcfc0bfbd9083b181db7ffc Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:25:06 -0400 Subject: [PATCH] fix: revert gamescope patch 0113 now that games run on their own Xwayland (#372) --- .github/workflows/build.yml | 2 +- tools/build_local.sh | 2 +- tools/gamescope/PATCHES.md | 8 -- ...am-overlay-keeps-game-keyboard-focus.patch | 104 ------------------ tools/gamescope/release.env | 5 +- 5 files changed, 5 insertions(+), 116 deletions(-) delete mode 100644 tools/gamescope/patches/0113-steam-overlay-keeps-game-keyboard-focus.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b0cd12bc..68b652ed0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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" diff --git a/tools/build_local.sh b/tools/build_local.sh index bda425616..82e079efe 100755 --- a/tools/build_local.sh +++ b/tools/build_local.sh @@ -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 diff --git a/tools/gamescope/PATCHES.md b/tools/gamescope/PATCHES.md index 1952e6c9b..ad4fc4b34 100644 --- a/tools/gamescope/PATCHES.md +++ b/tools/gamescope/PATCHES.md @@ -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. diff --git a/tools/gamescope/patches/0113-steam-overlay-keeps-game-keyboard-focus.patch b/tools/gamescope/patches/0113-steam-overlay-keeps-game-keyboard-focus.patch deleted file mode 100644 index 08ef94074..000000000 --- a/tools/gamescope/patches/0113-steam-overlay-keeps-game-keyboard-focus.patch +++ /dev/null @@ -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 ) diff --git a/tools/gamescope/release.env b/tools/gamescope/release.env index 55f3940d8..a0c6c614f 100644 --- a/tools/gamescope/release.env +++ b/tools/gamescope/release.env @@ -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