Skip to content

fix(qt): keep input and the window working in a gamescope session - #1418

Open
TheWeaklessOne wants to merge 3 commits into
OpenCloudGaming:devfrom
TheWeaklessOne:fix/linux-gamescope-session
Open

TheWeaklessOne wants to merge 3 commits into
OpenCloudGaming:devfrom
TheWeaklessOne:fix/linux-gamescope-session

Conversation

@TheWeaklessOne

Copy link
Copy Markdown

Under gamescope (SteamOS game mode, handhelds) OpenNOW is the only, always fullscreen client and input comes from a controller or a touchscreen. Three things go wrong there:

  • Input stops after an overlay closes. Capture requires Qt focus on the video item, and nothing gives it back: no mouse click lands on the video, and controller input is dropped while capture is off. syncCaptureState() now treats an active window as enough in a gamescope session and takes the focus itself. Another window on top, such as a sign-in browser, still stops capture.
  • The window is letterboxed. gamescope scales the window to the output, so a saved desktop size came out letterboxed and upscaled. restoreWindowGeometry skips the saved size and the window opens fullscreen. The --fullscreen path is unchanged.
  • The first absolute/relative choice. The mouse starts absolute in a gamescope session, so taps and the server-drawn cursor line up. Server cursor messages and the pointer-lock toggle still change it afterwards.

The session is detected once per item from GAMESCOPE_WAYLAND_DISPLAY. Nothing changes outside gamescope.

Verification:

  • New gamescopeSessionCapturesWithoutItemFocus: fails without the change (item.captureActive() stays false), passes with it.
  • On clean dev with this change (plus fix(qt): build with Qt 6.8.0 qmlcachegen output #1417 to build on Qt 6.8.0): opennow-streamvideo-tests 328 passed, 10 skipped; opennow-embedded-orchestration-tests 175 passed; opennow-qt builds.
  • On an Odin 2 Portal under gamescope, earlier revision of the same change: controller, keyboard and touch input reach the rig after closing overlays, the window fills the panel.

The live test ran with the session check as a file-scope helper rather than the member it is now; the behaviour is the same. The full CTest suite was not run.

🤖 Generated with Claude Code

Under gamescope (SteamOS game mode, handhelds) OpenNOW is the only, always
fullscreen client and input comes from a controller or a touchscreen.
- Capture required Qt focus on the video item, and nothing gave it back after
  an overlay closed: no mouse click lands on the video, and controller input
  is dropped meanwhile. Take the focus whenever the window is active.
- A saved desktop window size was letterboxed and upscaled. Skip the saved
  geometry and open fullscreen.
- The mouse stays absolute by default, so taps and the server-drawn cursor
  line up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: edb2b6fb-8820-429e-b77f-48eec83b436a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-12T02:08:00.255393Z
We couldn’t complete this review. Comment @codex review to try again.
feba190 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45f6a0379a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +941 to +943
const bool focused = window() && window()->isActive() && (hasActiveFocus() || m_gamescopeSession);
auto desired = m_inputEnabled && !m_nativeWindowMoveLoop && isVisible() && focused
&& s_nativeRuntime && s_nativeRuntime->running() && s_nativeRuntime->inputAllowed();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor disabled stream surfaces before reclaiming capture

In a gamescope desktop NVST launch, DesktopStreamScreen.qml:125–128 disables the video item while launchCovered is true but leaves inputEnabled true once the streamer reports streaming; the cover remains until the first-frame event. The new focus bypass therefore calls setCaptureActive(true, ...) for a disabled, covered surface, allowing controller snapshots to reach the remote game while the user still sees “Connecting to your game”. Require isEnabled() before reacquiring capture and resynchronize when enabled changes, so focus recovery preserves the existing launch-cover input gate.

AGENTS.md reference: AGENTS.md:L191-L192

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, confirmed against DesktopStreamScreen.qml. Fixed in 8f61d9e: the gamescope path now requires isEnabled(), and enabledChanged resyncs capture so input starts once the cover lifts. Covered by gamescopeSessionKeepsDisabledItemOutOfCapture.

: s_nativeRuntime->defaultRelativeMouse();
m_relativeMouse = m_usesMacPointerCapture
? m_macPointerLockEnabled
: s_nativeRuntime->defaultRelativeMouse() && !m_gamescopeSession;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the gamescope mouse default during cursor resets

For normal WebRTC launches under gamescope, this constructor-only override is overwritten before gameplay begins. The desktop stream item exists before session startup, and accepting a WebRTC session sets defaultRelativeMouse to true and emits cursorStateReset in NativeStreamRuntime.cpp:1337–1340. The connected resetRemoteCursor() still uses the runtime default without checking gamescope (StreamVideoItemInput.cpp:1147–1148), switching the item back to relative mode. Consequently, the new absolute-mouse default does not take effect for these launches or restarts. Apply the gamescope-aware fallback in the reset path as well, while preserving explicit pointer-lock choices.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed. Fixed in 8f61d9e: the constructor and resetRemoteCursor() now share one defaultRelativeMouse() helper with the gamescope check, and a manual pointer-lock choice still takes precedence. Covered by gamescopeSessionKeepsAbsoluteMouseWhenTheDefaultChanges.

Under gamescope the capture path no longer waits for item focus, so a
disabled item behind the launch cover took input while the user still saw
"Connecting to your game". Require the item to be enabled, and resync when
that changes.

Accepting a WebRTC session resets the cursor to the runtime default, which
switched the item back to relative mode. Apply the gamescope default in
that path too; an explicit pointer-lock choice still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheWeaklessOne

Copy link
Copy Markdown
Author

Follow-up in 8f61d9e for the two review comments above. opennow-streamvideo-tests on x86_64 (WSL, Qt 6.10.2): 330 passed, 10 skipped, including the two new tests.

Not rerun on the device or on Qt 6.8.0, and opennow-embedded-orchestration-tests was not rerun on this revision.

…ssion

# Conflicts:
#	opennow-qt/src/app/ApplicationStartup.cpp
@TheWeaklessOne

Copy link
Copy Markdown
Author

Merged current dev in feba190 to resolve the conflict in ApplicationStartup.cpp: dev now holds acceptance as a pointer, and the gamescope fullscreen condition is kept on top of that. On x86_64 (WSL, Qt 6.10.2): opennow-streamvideo-tests 331 passed, 10 skipped, opennow-embedded-orchestration-tests 177 passed, and opennow-qt builds. Not rerun on the device.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

This branch has not been deployed

No deployments
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