Skip to content

Keep drag-to-snap on the other displays while a window is fullscreen - #1949

Merged
rxhanson merged 3 commits into
rxhanson:mainfrom
AkiyamaKunka:fix/snapping-fullscreen-per-display
Nov 3, 2026
Merged

rxhanson merged 3 commits into
rxhanson:mainfrom
AkiyamaKunka:fix/snapping-fullscreen-per-display

Conversation

@AkiyamaKunka

Copy link
Copy Markdown
Contributor

Closes #1260

With a window in fullscreen on one display, dragging a window on another display does not snap: there is no footprint and nothing happens on release. The latest report on the issue describes exactly this on macOS 27.0.1 with Rectangle 2.0.3.

Cause

SnappingManager stops listening for mouse events whenever the frontmost window is fullscreen (v0.54), and re-checks when the front app or the active Space changes (the v0.55 fix for the same multi-display scenario) or the session becomes active again. With separate Spaces per display, a fullscreen window only takes over its own display, so this leaves two holes:

  • Dragging another window of the same app on the other display, for example a second browser window while a video plays fullscreen in the first, never re-checks anything, because the front app does not change. Nothing snaps until the app or Space changes.
  • Dragging a window of another app re-checks on the app switch, but listening only starts after the switch has been handled, so the mouse-down that began the drag is missed and the gesture is picked up part-way through.

What changes

  • FullScreenSnapGate, a small value type in SnappingManager.swift, records which display the fullscreen front window is on. checkFullScreen() builds it from the front window's frame and the current display frames, at every moment it did before, plus display changes (below).
  • With more than one display, listening continues. A mouse gesture that starts on the fullscreen display is ignored from mouse-down to mouse-up: no window lookup, no drag tracking, no footprint, which is what the previous state of no listening amounted to for those gestures. It still clears a previous gesture whose release never arrived, as every mouse-down did, and a gesture in flight is forgotten when listening stops, so a restarted monitor judges the first gesture it sees on its own. Gestures on the other displays snap as usual.
  • With a single display, or when the fullscreen window's display cannot be determined, listening stops exactly as before.
  • Display changes (NSApplication.didChangeScreenParametersNotification) re-run the check, since the display frames feed the gate and a display can come or go, or move, while a window stays fullscreen.
  • isFullScreen remains as a view on the gate, so the existing session tests and any other reader are unchanged. No new preference, no WindowManager change.

One consequence worth stating: on a multi-display Mac with the Mission Control dragging prevention on, its event tap now stays installed while a fullscreen window is front, so its top-edge filter, unchanged, also sees drags inside the fullscreen window when that display is the main one. All the filter does is keep a drag pinned to the top edge one point below it; the handler ignores those gestures.

Tests

FullScreenSnapGateTests covers the decision table: no gating without a fullscreen window, a fullscreen window on one of two displays blocks gestures there only, the only display or an unknown window frame still stops listening, and the display showing most of the window is chosen. SnappingManagerFullScreenTests drives handle(event:) with synthesized events: a gesture on the fullscreen display is left alone through mouse-down, drag and mouse-up, a gesture on the other display is tracked, each gesture is judged on its own, a gesture in flight is forgotten when listening stops, an ignored press finishes a gesture whose release was lost, listening continues or stops as described, and a display change re-evaluates the gate.

The full RectangleTests suite passes: 665 tests, 0 failures, on macOS 27.0.1 / Xcode 27. I have not yet exercised it against a fullscreen window on a two-display Mac; happy to do so and report before merge if you would like.

AkiyamaKunka and others added 3 commits October 29, 2026 13:49
Snapping stopped listening for mouse events whenever the frontmost
window was fullscreen, and re-checked only on app and Space changes.
With separate Spaces per display, a fullscreen window takes over its
own display only, so dragging another window of the same app on a
second display never snapped, and a drag of another app's window was
only picked up part-way through (rxhanson#1260).

FullScreenSnapGate records the fullscreen window's display. With more
than one display, listening continues and gestures that start on that
display are ignored from mouse-down to mouse-up, which is what the
absence of listening amounted to for them; the other displays snap as
usual. A single display, or an unknown display, still stops listening
as before, and display changes re-run the check.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Keeps both sets of tests appended at the end of RectangleTests.swift: the
adjacent-display tests from rxhanson#1937 and this branch's fullscreen gate tests.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Keeps this branch's two test classes appended after the Todo reflow
tests that rxhanson#1947 added at the end of RectangleTests.swift.

Also restores the two closing braces at the end of
NewWindowActionManagerTests that the merge of rxhanson#1945 into main dropped;
without them the RectangleTests target does not compile on main.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@rxhanson
rxhanson merged commit 58c1c63 into rxhanson:main Nov 3, 2026
1 check passed
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.

Rectangle snap to corners stops working after safari video player goes fullscreen.

2 participants