@@ -70,17 +70,12 @@ final class MenuBarLayoutManager {
7070 /// Quartz screen coordinates captured before any synthetic menu-bar event.
7171 func currentPointerLocation( ) -> CGPoint ? { CGEvent ( source: nil ) ? . location }
7272
73- /// Reassociates WindowServer with the real pointer after a synthetic click.
74- ///
75- /// The order is intentional: Quartz documents that warping does not emit a
76- /// mouse event, and associating before the warp can leave the hardware mouse
77- /// and cursor in the disconnected state on recent macOS releases. Warp
78- /// first, associate afterwards, then send a zero-delta move so other apps
79- /// recompute hover/cursor tracking immediately.
73+ /// Synchronizes WindowServer's logical pointer with the real pointer after
74+ /// a synthetic click. Do not use CGWarpMouseCursorPosition here: warping
75+ /// changes the cursor association globally and does not emit a move event,
76+ /// which can leave other applications with stale hover/cursor state.
8077 func restorePointerLocation( _ point: CGPoint ? ) {
8178 guard let point, Self . isValidPointerLocation ( point) else { return }
82- _ = CGWarpMouseCursorPosition ( point)
83- _ = CGAssociateMouseAndMouseCursorPosition ( 1 )
8479 guard let source = CGEventSource ( stateID: . hidSystemState) ,
8580 let move = CGEvent ( mouseEventSource: source, mouseType: . mouseMoved, mouseCursorPosition: point, mouseButton: . left) else { return }
8681 move. setIntegerValueField ( . mouseEventDeltaX, value: 0 )
0 commit comments