Module: wine Branch: master Commit: a85f11c2e63078e6572481092dbdc5b96b04d7a0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a85f11c2e63078e6572481092d...
Author: Ken Thomases ken@codeweavers.com Date: Mon Oct 10 22:38:13 2016 -0500
winemac: Post WINDOW_FRAME_CHANGED with the non-fullscreen frame when exiting of fullscreen mode begins.
We had been posting it when exiting fullscreen mode ended. However, certain events during exiting could provoke the back-end to assert the window frame as it knows it, which would be the one from full-screen mode. This would be handled by the Cocoa thread after exiting full-screen mode. So, the window would animate to its pre-fullscreen frame and then spontaneously go back to covering the screen. This would be Windows-style fullscreen rather than Cocoa-style and there'd be no obvious way to get out.
The problem occurs on macOS 10.12 (Sierra) due to a change in what methods it calls on the window while exiting fullscreen.
Signed-off-by: Ken Thomases ken@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winemac.drv/cocoa_window.m | 48 ++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 8e8ac9f..e638991 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -1842,6 +1842,30 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi macdrv_release_event(event); }
+ - (void) postWindowFrameChanged:(NSRect)frame fullscreen:(BOOL)isFullscreen resizing:(BOOL)resizing + { + macdrv_event* event; + NSUInteger style = self.styleMask; + + if (isFullscreen) + style |= NSFullScreenWindowMask; + else + style &= ~NSFullScreenWindowMask; + frame = [[self class] contentRectForFrameRect:frame styleMask:style]; + [[WineApplicationController sharedController] flipRect:&frame]; + + /* Coalesce events by discarding any previous ones still in the queue. */ + [queue discardEventsMatchingMask:event_mask_for_type(WINDOW_FRAME_CHANGED) + forWindow:self]; + + event = macdrv_create_event(WINDOW_FRAME_CHANGED, self); + event->window_frame_changed.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); + event->window_frame_changed.fullscreen = isFullscreen; + event->window_frame_changed.in_resize = resizing; + [queue postEvent:event]; + macdrv_release_event(event); + } + - (void) updateForCursorClipping { [self adjustFeaturesForState]; @@ -2589,7 +2613,6 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void)windowDidResize:(NSNotification *)notification { - macdrv_event* event; NSRect frame = self.wine_fractionalFrame;
if ([self inLiveResize]) @@ -2600,28 +2623,18 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi resizingFromTop = TRUE; }
- frame = [self contentRectForFrameRect:frame]; - if (ignore_windowResize || exitingFullScreen) return;
if ([self preventResizing]) { - [self setContentMinSize:frame.size]; - [self setContentMaxSize:frame.size]; + NSRect contentRect = [self contentRectForFrameRect:frame]; + [self setContentMinSize:contentRect.size]; + [self setContentMaxSize:contentRect.size]; }
- [[WineApplicationController sharedController] flipRect:&frame]; - - /* Coalesce events by discarding any previous ones still in the queue. */ - [queue discardEventsMatchingMask:event_mask_for_type(WINDOW_FRAME_CHANGED) - forWindow:self]; - - event = macdrv_create_event(WINDOW_FRAME_CHANGED, self); - event->window_frame_changed.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); - event->window_frame_changed.fullscreen = ([self styleMask] & NSFullScreenWindowMask) != 0; - event->window_frame_changed.in_resize = [self inLiveResize]; - [queue postEvent:event]; - macdrv_release_event(event); + [self postWindowFrameChanged:frame + fullscreen:([self styleMask] & NSFullScreenWindowMask) != 0 + resizing:[self inLiveResize]];
[[[self contentView] inputContext] invalidateCharacterCoordinates]; [self updateFullscreen]; @@ -2683,6 +2696,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi - (void) windowWillExitFullScreen:(NSNotification*)notification { exitingFullScreen = TRUE; + [self postWindowFrameChanged:nonFullscreenFrame fullscreen:FALSE resizing:FALSE]; }
- (void)windowWillMiniaturize:(NSNotification *)notification