Skip to content

gamescope: forward wl_touch input in the nested Wayland backend#2

Open
brycesub wants to merge 3 commits into
virtudude:mainfrom
brycesub:gamescope-wayland-touch
Open

gamescope: forward wl_touch input in the nested Wayland backend#2
brycesub wants to merge 3 commits into
virtudude:mainfrom
brycesub:gamescope-wayland-touch

Conversation

@brycesub

@brycesub brycesub commented Jul 8, 2026

Copy link
Copy Markdown

gamescope's nested (Wayland) backend wires up pointer and keyboard input from the host compositor but never requests wl_touch from the seat — the m_pTouch member exists upstream but is dead code — so touchscreens do nothing whenever gamescope runs as a window inside another compositor.

This adds the wl_touch listener on the input thread and translates down/up/motion/cancel into wlserver touch input, using the same fractional-scale + plane-offset coordinate normalization as the existing pointer path (and the same wlserver_touch* calls the SDL backend uses).

Why

Part of AYN Thor dual-screen phase 2 (virtudude/armada#28): gaming mode as a nested gamescope inside the desktop session, Steam on the top screen and plasma on the bottom. Without this, the top screen loses touch in nested mode.

Validation (on hardware)

Built 3.16.24 + this patch for aarch64 and ran it as the nested gaming compositor on an AYN Thor: taps land exactly on target across the top screen in Steam gamepadui, scrolling works, and the bottom-screen desktop touch is unaffected. The patch applies cleanly via the spec's %autopatch -p1.

Upstream candidate for ValveSoftware/gamescope — happy to submit it there too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMbeBSJJG1pNfdqkUcG1gn

The Wayland backend's input thread only wired up pointer and keyboard;
wl_touch was declared but never requested from the seat, so touch was
dead whenever gamescope runs nested under another compositor. Add the
wl_touch listener and translate events into wlserver touch input with
the same normalized coordinates the pointer path uses.

Needed for the dual-screen nested gaming session on the AYN Thor
(virtudude/armada#28 phase 2), where gamescope runs as a fullscreen
window inside the desktop session. Validated on hardware: taps land
exactly on target on the top screen; multi-touch ids tracked; cancel
releases all held touches.

Upstream candidate for ValveSoftware/gamescope.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMbeBSJJG1pNfdqkUcG1gn
brycesub and others added 2 commits July 7, 2026 21:32
GetValidDynamicRefreshRates() returned an empty span in the Wayland
backend (the host's mode list is not visible to a nested client), so
gamescope_control advertised only the current rate and Steam's refresh
slider collapsed to a single value. Read GAMESCOPE_NESTED_REFRESH_RATES
(comma-separated Hz, set by armada's nested-gaming from
ARMADA_PANEL_REFRESH_RATES) so Steam offers the panel's real range; the
nested-refresh-bridge in armada applies the requested mode through the
host compositor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMbeBSJJG1pNfdqkUcG1gn
The Wayland backend requested fullscreen with a null output, so the
host compositor placed gaming mode on whichever output was last active
- on dual-screen devices sometimes the wrong panel. Track wl_output
names and pass the first -O/--prefer-output match to the fullscreen
request; armada's nested-gaming passes the device's primary connector.

Validated on AYN Thor: gaming mode lands on the top screen on every
launch regardless of pointer/focus position.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMbeBSJJG1pNfdqkUcG1gn
@brycesub

brycesub commented Jul 8, 2026

Copy link
Copy Markdown
Author

Pushed two more nested-backend patches, both hardware-validated on the Thor alongside the touch one: 0008 advertises panel refresh rates from GAMESCOPE_NESTED_REFRESH_RATES (Steam's refresh slider was collapsing to a single value — the nested backend can't enumerate host modes), and 0009 honors -O/--prefer-output for the fullscreen request (gaming mode otherwise landed on whichever screen the host compositor considered active). Both pair with launcher changes in virtudude/armada#80.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMbeBSJJG1pNfdqkUcG1gn

@brycesub

brycesub commented Jul 8, 2026

Copy link
Copy Markdown
Author

The wl_touch patch is now submitted upstream: ValveSoftware/gamescope#2244. If it lands there, patch 0007 can be dropped on the next gamescope version bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMbeBSJJG1pNfdqkUcG1gn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant