winemac: Track whether our windows would be visible if the process weren't hidden.
The -[NSWindow isVisible] method returns FALSE when the process is hidden, but that's not what we need to know in some cases. This fixes full-screen games which minimize their window when they lose focus. Command-Tabbing away hides the process. Because the window was not visible, the code didn't actually minimize it. When switching back to the process, no event was sent to the Wine back-end telling it the window had been restored, so it never resumed drawing to it.
This commit is contained in:
parent
6447e8e75c
commit
ae47323604
|
@ -33,6 +33,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
|
|||
BOOL maximized;
|
||||
BOOL fullscreen;
|
||||
BOOL pendingMinimize;
|
||||
BOOL savedVisibleState;
|
||||
WineWindow* latentParentWindow;
|
||||
NSMutableArray* latentChildWindows;
|
||||
|
||||
|
|
|
@ -543,6 +543,7 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w
|
|||
WineWindow* window;
|
||||
WineContentView* contentView;
|
||||
NSTrackingArea* trackingArea;
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[[WineApplicationController sharedController] flipRect:&window_frame];
|
||||
|
||||
|
@ -595,12 +596,21 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w
|
|||
[window setContentView:contentView];
|
||||
[window setInitialFirstResponder:contentView];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:window
|
||||
selector:@selector(updateFullscreen)
|
||||
name:NSApplicationDidChangeScreenParametersNotification
|
||||
object:NSApp];
|
||||
[nc addObserver:window
|
||||
selector:@selector(updateFullscreen)
|
||||
name:NSApplicationDidChangeScreenParametersNotification
|
||||
object:NSApp];
|
||||
[window updateFullscreen];
|
||||
|
||||
[nc addObserver:window
|
||||
selector:@selector(applicationWillHide)
|
||||
name:NSApplicationWillHideNotification
|
||||
object:NSApp];
|
||||
[nc addObserver:window
|
||||
selector:@selector(applicationDidUnhide)
|
||||
name:NSApplicationDidUnhideNotification
|
||||
object:NSApp];
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@ -714,9 +724,15 @@ - (void) setWindowFeatures:(const struct macdrv_window_features*)wf
|
|||
[self setHasShadow:wf->shadow];
|
||||
}
|
||||
|
||||
// Indicates if the window would be visible if the app were not hidden.
|
||||
- (BOOL) wouldBeVisible
|
||||
{
|
||||
return [NSApp isHidden] ? savedVisibleState : [self isVisible];
|
||||
}
|
||||
|
||||
- (BOOL) isOrderedIn
|
||||
{
|
||||
return [self isVisible] || [self isMiniaturized];
|
||||
return [self wouldBeVisible] || [self isMiniaturized];
|
||||
}
|
||||
|
||||
- (NSInteger) minimumLevelForActive:(BOOL)active
|
||||
|
@ -827,7 +843,7 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
|
|||
pendingMinimize = FALSE;
|
||||
if (state->minimized && ![self isMiniaturized])
|
||||
{
|
||||
if ([self isVisible])
|
||||
if ([self wouldBeVisible])
|
||||
{
|
||||
if ([self styleMask] & NSFullScreenWindowMask)
|
||||
{
|
||||
|
@ -1198,6 +1214,7 @@ - (void) doOrderOut
|
|||
}
|
||||
else
|
||||
[self orderOut:nil];
|
||||
savedVisibleState = FALSE;
|
||||
if (wasVisible && wasOnActiveSpace && fullscreen)
|
||||
[controller updateFullscreenWindows];
|
||||
[controller adjustWindowLevels];
|
||||
|
@ -1637,6 +1654,17 @@ - (void) flagsChanged:(NSEvent *)theEvent
|
|||
}
|
||||
}
|
||||
|
||||
- (void) applicationWillHide
|
||||
{
|
||||
savedVisibleState = [self isVisible];
|
||||
}
|
||||
|
||||
- (void) applicationDidUnhide
|
||||
{
|
||||
if ([self isVisible])
|
||||
[self becameEligibleParentOrChild];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------- NSWindowDelegate methods ----------
|
||||
|
|
Loading…
Reference in New Issue