winemac: Prevent maximized windows from entering Cocoa full-screen mode.

OS X doesn't really have the concept of windows being maximized; that is, being
in a mode where they can't be moved or resized.  As a consequence, it doesn't
have a button in the window title bar to restore a maximized window to normal.
So, when a Wine window is maximized, the Mac driver hijacks the green zoom
button to act as a restore button.  (When a window is zoomed, the green button
"unzooms" back to its last user size and position, so it's analogous.)

However, with OS X 10.10 (Yosemite), the green button prefers to act as a
toggle for the Cocoa full-screen mode rather than zooming and unzooming.  This
made it difficult for users to restore a maximized window.  They would have to
Option-click the green button, double-click the title bar, or choose Zoom
from the Window menu, none of which is obvious.

The fix is to disable Cocoa full-screen mode for maximized windows.  Then, the
green button reverts to unzoom and restoring the window.
oldstable
Ken Thomases 2015-03-12 18:45:25 -05:00 committed by Alexandre Julliard
parent 4af5d5bd99
commit 14a0fc3ccc
1 changed files with 22 additions and 22 deletions

View File

@ -699,7 +699,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
NSUInteger style = [self styleMask];
if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
style & NSResizableWindowMask && !(style & NSUtilityWindowMask))
style & NSResizableWindowMask && !(style & NSUtilityWindowMask) && !maximized)
{
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
@ -852,25 +852,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
[[WineApplicationController sharedController] adjustWindowLevels];
}
behavior = NSWindowCollectionBehaviorDefault;
if (state->excluded_by_expose)
behavior |= NSWindowCollectionBehaviorTransient;
else
behavior |= NSWindowCollectionBehaviorManaged;
if (state->excluded_by_cycle)
{
behavior |= NSWindowCollectionBehaviorIgnoresCycle;
if ([self isOrderedIn])
[NSApp removeWindowsItem:self];
}
else
{
behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
if ([self isOrderedIn])
[NSApp addWindowsItem:self title:[self title] filename:NO];
}
[self adjustFullScreenBehavior:behavior];
if (state->minimized_valid)
{
macdrv_event_mask discard = event_mask_for_type(WINDOW_DID_UNMINIMIZE);
@ -912,6 +893,25 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
maximized = state->maximized;
[self adjustFeaturesForState];
}
behavior = NSWindowCollectionBehaviorDefault;
if (state->excluded_by_expose)
behavior |= NSWindowCollectionBehaviorTransient;
else
behavior |= NSWindowCollectionBehaviorManaged;
if (state->excluded_by_cycle)
{
behavior |= NSWindowCollectionBehaviorIgnoresCycle;
if ([self isOrderedIn])
[NSApp removeWindowsItem:self];
}
else
{
behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
if ([self isOrderedIn])
[NSApp addWindowsItem:self title:[self title] filename:NO];
}
[self adjustFullScreenBehavior:behavior];
}
- (BOOL) addChildWineWindow:(WineWindow*)child assumeVisible:(BOOL)assumeVisible
@ -1570,7 +1570,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
if ([menuItem action] == @selector(makeKeyAndOrderFront:))
ret = [self isKeyWindow] || (!self.disabled && !self.noActivate);
if ([menuItem action] == @selector(toggleFullScreen:) && self.disabled)
if ([menuItem action] == @selector(toggleFullScreen:) && (self.disabled || maximized))
ret = NO;
return ret;
@ -1609,7 +1609,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
- (void) toggleFullScreen:(id)sender
{
if (!self.disabled)
if (!self.disabled && !maximized)
[super toggleFullScreen:sender];
}