android: GAMENATIVE_ROOT_DESKTOP switches A26, A33 and A48 off on wine's root desktop
The app is getting a second launch mode for newer Proton builds: wine explorer /desktop=root instead of /desktop=shell,WxH. There is no virtual desktop window then; each game window is a managed top-level X window, which is what upstream gamescope expects.
Three patches exist only for the virtual-desktop model, where gamescope sees one top-level window (wine's desktop) with the game nested inside it:
- A26 (
0026-A26-uniform-app-id.patch) gives every window app id 1. - A33 (
0033-A33-blank-while-game-window-absent.patch) blanks the output while the game's window is absent, so wine's desktop is not shown at startup and exit. - A48 (
0047-A48-bring-nested-app-window-to-front.patch) sends winhandler.exe a bring-to-front request when a nested child maps.
This PR adds one environment variable, GAMENATIVE_ROOT_DESKTOP, read once at startup. The app sets it for root-desktop sessions.
- Unset,
0or any other value: the three patches act as today. The only difference is one addedroot_desktop=0field in A33'ssession-blanklog line. 1: A26 keeps upstream'sappID(the X window id), A33 never raises either blank, and A48 never sends.
The three patch files are edited in place and regenerated at their position in the series; no files are renamed or added. The helper lives in A26 because it is the earliest of the three. android/README.md gets a short section on the variable.
Relation to GameNative/gamescope#38: that PR drops the three patches for everyone. This one has the same effect for root-desktop sessions but keeps the patches for virtual-desktop sessions, which older Proton builds still use (NFS Most Wanted needs A48 there, per the comments on #38).
Two things the variable does not switch:
- With
1, app ids are window ids, so agamescope_controlperformance-stats request for app id 1 (what A26 was there for) matches no window. The app side needs another way to name the window before relying on those stats in root sessions. - A33's change to the blank texture's extent (output size instead of the 1080p cap, in
rendervulkan.cpp) stays for both modes. The upstream overlay hack-plane also uses that texture.
Tested
- The full series (gamescope patches, then wlroots) applies in order with
git apply --checkon a clean checkout ofgamenative3d10d68. I applied the old and new series to two clean trees and diffedsrc/: the only differences are the helper, the gated sites and the log field. The wlroots trees are identical. Diagnostics 0018 applies. Diagnostics 0023 already fails ongamenativewithout this change. - Not compiled locally (no termux prefix on the Mac). CI compiles it.
- No device run has been made with the variable set yet. A run on the Odin 3 will be added to this description.
Observations from 2026-11-15 on an AYN Odin 3 with the current payload, all three patches active, root desktop: a normal game (top-level 1280x720, focused) took pad input with no A48 log lines and exited cleanly. In one root session A33 held its blank for the whole session because no newer commit arrived, so A33 does act under the root desktop.