From 74567cf0e43fecf2f994fb06f16c6866c93f27d3 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Thu, 22 Nov 2018 19:13:29 +0000 Subject: Fix coordinates when window exits full screen --- macosx/tkMacOSXWindowEvent.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 2e5be8f..44702e6 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -156,6 +156,26 @@ extern NSString *NSWindowDidOrderOffScreenNotification; } } +- (void) windowExitedFullScreen: (NSNotification *) notification +{ +#ifdef TK_MAC_DEBUG_NOTIFICATIONS + TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); +#endif + NSWindow *w = [notification object]; + TkWindow *winPtr = TkMacOSXGetTkWindow(w); + MacDrawable *macWin = winPtr->privatePtr; + + /* + * We must apply the current window attributes when the window becomes a + * FullScreen or a split screen window. Otherwise the mouse cursor will be + * offset by the title bar height. The notification is sent in both cases. + */ + + if (winPtr) { + TkMacOSXApplyWindowAttributes(macWin->winPtr, w); + } +} + - (void) windowCollapsed: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS @@ -249,6 +269,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; observe(NSWindowDidDeminiaturizeNotification, windowExpanded:); observe(NSWindowDidMiniaturizeNotification, windowCollapsed:); observe(NSWindowDidEnterFullScreenNotification, windowEnteredFullScreen:); + observe(NSWindowDidExitFullScreenNotification, windowExitedFullScreen:); #ifdef TK_MAC_DEBUG_NOTIFICATIONS observe(NSWindowWillMoveNotification, windowDragStart:); observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:); -- cgit v0.12