Skip to content

fix: prewarmed overlay blocking clicks by ignoring cursor events when…#1523

Merged
richiemcilroy merged 7 commits intoCapSoftware:mainfrom
lianshuang-photo:fix/prewarmed-overlay-blocking-clicks
Jan 15, 2026
Merged

fix: prewarmed overlay blocking clicks by ignoring cursor events when…#1523
richiemcilroy merged 7 commits intoCapSoftware:mainfrom
lianshuang-photo:fix/prewarmed-overlay-blocking-clicks

Conversation

@lianshuang-photo
Copy link
Copy Markdown

@lianshuang-photo lianshuang-photo commented Jan 15, 2026

Problem

The prewarmed target-select-overlay windows introduced in v0.4.4 (commit 0f456b1) block all click events on the main window, making the app completely unusable after startup.

Discovered on: macOS (Apple Silicon/ARM)

Root Cause

Prewarmed overlay windows are created at startup and hidden for faster display, but they still intercept mouse events even when invisible, as they cover the entire screen.

Solution

  • Set ignore_cursor_events(true) when creating prewarmed windows to let clicks pass through
  • Restore ignore_cursor_events(false) when showing the window to enable interaction

Testing

  • ✅ Main window is now clickable after startup
  • ✅ Target selection overlay still works correctly when activated
  • ✅ Prewarming optimization is preserved
  • ✅ No regression in other functionality

Tested on: macOS (Apple Silicon)

Changes

Modified apps/desktop/src-tauri/src/target_select_overlay.rs:

  • Added set_ignore_cursor_events(true) in prewarm_target_select_overlays() after window creation
  • Added set_ignore_cursor_events(false) in open_target_select_overlays() before showing window

Greptile Summary

Fixed a critical bug introduced in v0.4.4 where prewarmed overlay windows blocked all mouse interactions with the main window on macOS. The fix adds set_ignore_cursor_events(true) when creating prewarmed windows and restores set_ignore_cursor_events(false) when displaying them.

Key changes:

  • In prewarm_target_select_overlays: Set ignore_cursor_events(true) after creating hidden overlay windows
  • In open_target_select_overlays: Set ignore_cursor_events(false) before showing the prewarmed window

The implementation correctly handles the window lifecycle and maintains the prewarming optimization while ensuring mouse events pass through when windows are hidden.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a minimal, targeted change that addresses a critical bug by correctly managing window cursor event handling. The implementation follows existing patterns in the codebase (other windows use the same approach), is well-tested by the author, and has no edge cases or potential side effects. The change is straightforward: ignore cursor events when windows are hidden, accept them when visible.
  • No files require special attention

Important Files Changed

Filename Overview
apps/desktop/src-tauri/src/target_select_overlay.rs Fixed critical bug where prewarmed overlay windows blocked all mouse events on the main window by setting ignore_cursor_events appropriately

Sequence Diagram

sequenceDiagram
    participant App as Desktop App
    participant Prewarm as prewarm_target_select_overlays
    participant Store as PrewarmedOverlays
    participant Window as Overlay Window
    participant Open as open_target_select_overlays
    participant User as User Interaction

    Note over App,Store: App Startup Phase
    App->>Prewarm: Call prewarm function
    loop For each display
        Prewarm->>Window: Create overlay window (hidden)
        Window-->>Prewarm: Window created
        Prewarm->>Window: set_ignore_cursor_events(true)
        Note over Window: Window ignores all mouse events
        Prewarm->>Store: Store prewarmed window
    end

    Note over App,User: User Triggers Recording
    User->>Open: Activate target selection
    Open->>Store: take(display_id)
    Store-->>Open: Return prewarmed window
    Open->>Window: set_ignore_cursor_events(false)
    Note over Window: Window now accepts mouse events
    Open->>Window: show() and set_focus()
    Window-->>User: Overlay visible and interactive
Loading

Note

Overlay and screenshot UX

  • Prewarm TargetSelectOverlay windows with hide() and set_ignore_cursor_events(true); restore with set_ignore_cursor_events(false) when shown
  • Hide all overlay windows before invoking take_screenshot to prevent interference; small delay to ensure state settles
  • Add AppSounds::Screenshot and suppress notification sounds for screenshot-related toasts; play a sound at capture time
  • Title added for Target Select window in windows.rs

Encoding, timing, and rendering stability

  • AVFoundation MP4: track writer_failed; check writer status in append_sample_buf; early-fail queueing after writer errors
  • Audio mux: introduce AudioDriftTracker with wall-clock clamping to correct drift; tighter audio wall-clock tolerance
  • Decoder: longer timeout for initial seek (get_frame_initial) and increased decode retries with backoff
  • Rendering: pipelined GPU readback supports deferred buffer resize; retry frame rendering on buffer map errors; resize render textures only on change
  • API adjustments and benchmarks updated to new decoder spawn signature

Written by Cursor Bugbot for commit d056e4a. This will update automatically on new commits. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 15, 2026

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@richiemcilroy richiemcilroy merged commit f96a74e into CapSoftware:main Jan 15, 2026
2 of 3 checks passed
@richiemcilroy
Copy link
Copy Markdown
Member

I added a few extra things sorry!

Thanks for the PR

.await
.map_err(|e| format!("Failed to capture screenshot: {e}"))?;

AppSounds::Notification.play();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Screenshot uses wrong sound variant

Low Severity

The new AppSounds::Screenshot enum variant is added with a dedicated screenshot.ogg sound file, but the screenshot capture code at line 1208 calls AppSounds::Notification.play() instead of AppSounds::Screenshot.play(). This means screenshots play the generic notification sound (action.ogg) rather than the intended dedicated screenshot sound.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

2 participants