Commit a85f11c2 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Post WINDOW_FRAME_CHANGED with the non-fullscreen frame when exiting of…

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: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 54002103
...@@ -1842,6 +1842,30 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi ...@@ -1842,6 +1842,30 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
macdrv_release_event(event); 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 - (void) updateForCursorClipping
{ {
[self adjustFeaturesForState]; [self adjustFeaturesForState];
...@@ -2589,7 +2613,6 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi ...@@ -2589,7 +2613,6 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void)windowDidResize:(NSNotification *)notification - (void)windowDidResize:(NSNotification *)notification
{ {
macdrv_event* event;
NSRect frame = self.wine_fractionalFrame; NSRect frame = self.wine_fractionalFrame;
if ([self inLiveResize]) if ([self inLiveResize])
...@@ -2600,28 +2623,18 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi ...@@ -2600,28 +2623,18 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
resizingFromTop = TRUE; resizingFromTop = TRUE;
} }
frame = [self contentRectForFrameRect:frame];
if (ignore_windowResize || exitingFullScreen) return; if (ignore_windowResize || exitingFullScreen) return;
if ([self preventResizing]) if ([self preventResizing])
{ {
[self setContentMinSize:frame.size]; NSRect contentRect = [self contentRectForFrameRect:frame];
[self setContentMaxSize:frame.size]; [self setContentMinSize:contentRect.size];
[self setContentMaxSize:contentRect.size];
} }
[[WineApplicationController sharedController] flipRect:&frame]; [self postWindowFrameChanged:frame
fullscreen:([self styleMask] & NSFullScreenWindowMask) != 0
/* Coalesce events by discarding any previous ones still in the queue. */ resizing:[self inLiveResize]];
[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 contentView] inputContext] invalidateCharacterCoordinates]; [[[self contentView] inputContext] invalidateCharacterCoordinates];
[self updateFullscreen]; [self updateFullscreen];
...@@ -2683,6 +2696,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi ...@@ -2683,6 +2696,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void) windowWillExitFullScreen:(NSNotification*)notification - (void) windowWillExitFullScreen:(NSNotification*)notification
{ {
exitingFullScreen = TRUE; exitingFullScreen = TRUE;
[self postWindowFrameChanged:nonFullscreenFrame fullscreen:FALSE resizing:FALSE];
} }
- (void)windowWillMiniaturize:(NSNotification *)notification - (void)windowWillMiniaturize:(NSNotification *)notification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment