From 14a0fc3cccc682796d3788f19f6195f1a9530852 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Thu, 12 Mar 2015 18:45:25 -0500 Subject: [PATCH] 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. --- dlls/winemac.drv/cocoa_window.m | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 8a02ff4e9f6..7f71fea70f9 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -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]; } -- 2.11.4.GIT