Repository navigation
Conversation
|
The macOS capture backends ignored the cursor visibility state: both started capturing with the cursor enabled and never reacted to the toggle while a stream was running. Convert the shared display_cursor flag to std::atomic<bool> with a CAS toggle in input handling, updating capture() signatures across backends so capture threads can safely read it without data races. On macOS, ScreenCaptureKit sets showsCursor on the initial stream configuration and pushes later changes via updateConfiguration, coalescing requests so only one update is in flight; AVFoundation sets capturesCursor on the screen input and re-reads the flag while waiting for frames so toggles apply even on a static screen.
a0f47b4 to
84a1d0c
Compare
ReenigneArcher
left a comment
There was a problem hiding this comment.
Requesting changes for the missing AVFoundation regression coverage described inline. I found no additional functional defects in the current diff, and the cursor bug is still present in the corresponding macOS paths on current master.
Validation: built test_sunshine on macOS with tray support disabled and cached dependencies; all 43 tests in SCCaptureLoop.*, KeyboardPassthroughTest.*, and DisplayHelpers.* passed. git diff --check and clang-format 23.1 checks passed. The proposed AVFoundation test supplied inline was separately compiled and passed. I did not perform end-to-end streaming or compile Windows/Linux.
Checks and merge status: head 84a1d0c4205c5644b8a52fb5bce44f5bf9713cba is mergeable against master (44f9ed981ea80b55648623a37338ed15181b8164). Actions are awaiting maintainer approval, leaving hosted cross-platform verification unavailable. SonarCloud's quality gate currently fails for 3.9% duplication and 8 duplicated blocks on new code; the changed Linux capture-loop hunks contain signature changes only. Read the Docs and the semantic PR check passed.
Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh
|


Description
Fixes an issue where the macOS capture backends (
ScreenCaptureKitandAVFoundation) ignored the cursor visibility toggle (Ctrl+Alt+Shift+N), always starting with the cursor visible and never reacting to toggles while a stream was running.Changes
display_cursortostd::atomic<bool>with a CAS toggle ininput.cpp, and updatedcapture()signatures across all platform backends and tests so capture threads can safely read the flag without data races. (This is why non-macOS backend files appear in the diff — no functional changes were made to Windows/Linux capture behavior.)display_cursorstate toshowsCursorwhen starting the stream, and pushes subsequent changes viaupdateConfiguration, coalescing updates so only one configuration change is in flight at a time.display_cursorstate tocapturesCursoron the screen input, and re-checks the flag while waiting for frames so toggles still take effect on a static screen.Screenshot
Not applicable — no UI changes.
Issues Fixed or Closed
No linked issue.
Roadmap Issues
Not applicable.
Testing
Automated
Full test suite passed on macOS:
879 passed, 8 skipped. App and Web UI built cleanly, and the modified translation units compile without warnings.New regression coverage in
tests/unit/platform/macos/test_sc_capture_loop.mm:SamplesCursorAtStartupAndOnPollsWithoutFrames— verifies the loop passes the startup state tostart()and re-samples the flag on every poll, including polls that deliver no frame.SerializesCursorUpdatesAndPreservesStreamConfiguration— verifies duplicate requests are coalesced while an update is in flight, that other configuration fields survive the update, and that updates are ignored after the stream is stopped.FailedCursorUpdateWakesCaptureForReinitialization— verifies a rejected configuration update marks the stream failed and wakes the capture loop so the display gets rebuilt.KeyboardPassthroughTest.CursorShortcutTogglesSharedCaptureStateintests/unit/test_keyboard.cpp— verifies the shortcut toggles the shared atomic flag and is consumed rather than forwarded.Manual
The following was verified by hand on physical hardware, not by an automated test.
Local frame capture verification (manually inspected): Captured frames were compared by eye for both backends. ScreenCaptureKit and AVFoundation were each confirmed to hide the cursor and restore it again, and ScreenCaptureKit was additionally confirmed to honor starting in the hidden state, i.e. a stream opened while the toggle was already off begins with no cursor.
End-to-end streaming (manually tested, Windows Moonlight -> macOS Sunshine):
Ctrl+Alt+Shift+N: cursor hides immediately and reappears on toggle back.Not covered
capture()signature changes touch those backends, so they still need compile verification from GitHub Actions.Notes
action_required— the workflows are waiting on maintainer approval for a first-time contributor, so no job has run yet. The Windows and Linux matrices are the remaining verification for thecapture()signature updates.4.1%on new code,8duplicated blocks, threshold is2%/0). The 4 lines counted as duplicates are the updatedcapture()override signatures inkmsgrab.cppandx11grab.cpp. They now accept the shared atomic cursor flag and sit inside existing duplicated Linux capture loops whose bodies are unchanged. Refactoring those Linux capture loops is intentionally out of scope for this macOS bug fix, so I would rather leave that gate to maintainer judgement than restructure unrelated platform code.@availableguards and AVFoundation behaviour.Type of Change
Checklist
AI Usage
See our AI usage policy.
AI assistance was used in two stages. The patch itself (the atomic-flag refactor, the cursor update plumbing, and the regression tests) was written by OpenAI Codex (GPT-6.2-sol). The comment and docstring review, formatting checks, local build and full test run on macOS, and this PR description were prepared with DeepSeek Harness (DeepSeek V4.1 Flash).