Commit 14a0fc3c authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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.
parent 4af5d5bd
...@@ -699,7 +699,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -699,7 +699,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
NSUInteger style = [self styleMask]; NSUInteger style = [self styleMask];
if (behavior & NSWindowCollectionBehaviorParticipatesInCycle && if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
style & NSResizableWindowMask && !(style & NSUtilityWindowMask)) style & NSResizableWindowMask && !(style & NSUtilityWindowMask) && !maximized)
{ {
behavior |= NSWindowCollectionBehaviorFullScreenPrimary; behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary; behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
...@@ -852,25 +852,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -852,25 +852,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
[[WineApplicationController sharedController] adjustWindowLevels]; [[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) if (state->minimized_valid)
{ {
macdrv_event_mask discard = event_mask_for_type(WINDOW_DID_UNMINIMIZE); 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 ...@@ -912,6 +893,25 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
maximized = state->maximized; maximized = state->maximized;
[self adjustFeaturesForState]; [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 - (BOOL) addChildWineWindow:(WineWindow*)child assumeVisible:(BOOL)assumeVisible
...@@ -1570,7 +1570,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1570,7 +1570,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
if ([menuItem action] == @selector(makeKeyAndOrderFront:)) if ([menuItem action] == @selector(makeKeyAndOrderFront:))
ret = [self isKeyWindow] || (!self.disabled && !self.noActivate); ret = [self isKeyWindow] || (!self.disabled && !self.noActivate);
if ([menuItem action] == @selector(toggleFullScreen:) && self.disabled) if ([menuItem action] == @selector(toggleFullScreen:) && (self.disabled || maximized))
ret = NO; ret = NO;
return ret; return ret;
...@@ -1609,7 +1609,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1609,7 +1609,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
- (void) toggleFullScreen:(id)sender - (void) toggleFullScreen:(id)sender
{ {
if (!self.disabled) if (!self.disabled && !maximized)
[super toggleFullScreen:sender]; [super toggleFullScreen:sender];
} }
......
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