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>
This commit is contained in:
Ken Thomases 2016-10-10 22:38:13 -05:00 committed by Alexandre Julliard
parent 5400210376
commit a85f11c2e6
1 changed files with 31 additions and 17 deletions

View File

@ -1842,6 +1842,30 @@ - (void) postBroughtForwardEvent
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 @@ - (void)windowDidResignKey:(NSNotification *)notification
- (void)windowDidResize:(NSNotification *)notification
{
macdrv_event* event;
NSRect frame = self.wine_fractionalFrame;
if ([self inLiveResize])
@ -2600,28 +2623,18 @@ - (void)windowDidResize:(NSNotification *)notification
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 @@ - (void) windowWillEnterFullScreen:(NSNotification*)notification
- (void) windowWillExitFullScreen:(NSNotification*)notification
{
exitingFullScreen = TRUE;
[self postWindowFrameChanged:nonFullscreenFrame fullscreen:FALSE resizing:FALSE];
}
- (void)windowWillMiniaturize:(NSNotification *)notification