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.
This commit is contained in:
parent
4af5d5bd99
commit
14a0fc3ccc
|
@ -699,7 +699,7 @@ - (void) adjustFullScreenBehavior:(NSWindowCollectionBehavior)behavior
|
|||
NSUInteger style = [self styleMask];
|
||||
|
||||
if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
|
||||
style & NSResizableWindowMask && !(style & NSUtilityWindowMask))
|
||||
style & NSResizableWindowMask && !(style & NSUtilityWindowMask) && !maximized)
|
||||
{
|
||||
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
|
||||
|
@ -852,25 +852,6 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
|
|||
[[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 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
|
|||
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 @@ - (BOOL) validateMenuItem:(NSMenuItem *)menuItem
|
|||
|
||||
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 @@ - (void) miniaturize:(id)sender
|
|||
|
||||
- (void) toggleFullScreen:(id)sender
|
||||
{
|
||||
if (!self.disabled)
|
||||
if (!self.disabled && !maximized)
|
||||
[super toggleFullScreen:sender];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue