winemac: Consider minimized windows as "on screen" for our purposes.

This commit is contained in:
Ken Thomases 2013-05-16 18:43:25 -05:00 committed by Alexandre Julliard
parent c3183fc007
commit 6d4098ebd3
1 changed files with 12 additions and 7 deletions

View File

@ -573,6 +573,11 @@ - (void) setWindowFeatures:(const struct macdrv_window_features*)wf
[self setHasShadow:wf->shadow]; [self setHasShadow:wf->shadow];
} }
- (BOOL) isOrderedIn
{
return [self isVisible] || [self isMiniaturized];
}
- (void) adjustWindowLevel - (void) adjustWindowLevel
{ {
WineApplicationController* controller = [WineApplicationController sharedController]; WineApplicationController* controller = [WineApplicationController sharedController];
@ -619,14 +624,14 @@ - (void) adjustWindowLevel
Also, any windows which are supposed to be in front of it had Also, any windows which are supposed to be in front of it had
better have the same or higher window level. If not, bump them better have the same or higher window level. If not, bump them
up. */ up. */
if (index != NSNotFound && [self isVisible]) if (index != NSNotFound && [self isOrderedIn])
{ {
for (; index > 0; index--) for (; index > 0; index--)
{ {
other = [[controller orderedWineWindows] objectAtIndex:index - 1]; other = [[controller orderedWineWindows] objectAtIndex:index - 1];
if ([other level] < level) if ([other level] < level)
[other setLevelWhenActive:level]; [other setLevelWhenActive:level];
else else if ([self isVisible])
{ {
[self orderWindow:NSWindowBelow relativeTo:[other windowNumber]]; [self orderWindow:NSWindowBelow relativeTo:[other windowNumber]];
break; break;
@ -654,13 +659,13 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
if (state->excluded_by_cycle) if (state->excluded_by_cycle)
{ {
behavior |= NSWindowCollectionBehaviorIgnoresCycle; behavior |= NSWindowCollectionBehaviorIgnoresCycle;
if ([self isVisible]) if ([self isOrderedIn])
[NSApp removeWindowsItem:self]; [NSApp removeWindowsItem:self];
} }
else else
{ {
behavior |= NSWindowCollectionBehaviorParticipatesInCycle; behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
if ([self isVisible]) if ([self isOrderedIn])
[NSApp addWindowsItem:self title:[self title] filename:NO]; [NSApp addWindowsItem:self title:[self title] filename:NO];
} }
[self setCollectionBehavior:behavior]; [self setCollectionBehavior:behavior];
@ -756,7 +761,7 @@ - (void) doOrderOut
- (BOOL) setFrameIfOnScreen:(NSRect)contentRect - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
{ {
NSArray* screens = [NSScreen screens]; NSArray* screens = [NSScreen screens];
BOOL on_screen = [self isVisible]; BOOL on_screen = [self isOrderedIn];
NSRect frame, oldFrame; NSRect frame, oldFrame;
if (![screens count]) return on_screen; if (![screens count]) return on_screen;
@ -892,7 +897,7 @@ - (void) makeFocused:(BOOL)activate
/* If a borderless window is offscreen, orderFront: won't move /* If a borderless window is offscreen, orderFront: won't move
it onscreen like it would for a titled window. Do that ourselves. */ it onscreen like it would for a titled window. Do that ourselves. */
screens = [NSScreen screens]; screens = [NSScreen screens];
if (!([self styleMask] & NSTitledWindowMask) && ![self isVisible] && if (!([self styleMask] & NSTitledWindowMask) && ![self isOrderedIn] &&
!frame_intersects_screens([self frame], screens)) !frame_intersects_screens([self frame], screens))
{ {
NSScreen* primaryScreen = [screens objectAtIndex:0]; NSScreen* primaryScreen = [screens objectAtIndex:0];
@ -1482,7 +1487,7 @@ void macdrv_set_cocoa_window_title(macdrv_window w, const unsigned short* title,
titleString = @""; titleString = @"";
OnMainThreadAsync(^{ OnMainThreadAsync(^{
[window setTitle:titleString]; [window setTitle:titleString];
if ([window isVisible] && ![window isExcludedFromWindowsMenu]) if ([window isOrderedIn] && ![window isExcludedFromWindowsMenu])
[NSApp changeWindowsItem:window title:titleString filename:NO]; [NSApp changeWindowsItem:window title:titleString filename:NO];
}); });