winemac: Defer minimizing hidden windows until they are shown.

Minimizing invisible windows causes weird phantoms to appear in
Exposé, the Window menu, and the Dock.
This commit is contained in:
Ken Thomases 2013-06-04 04:59:42 -05:00 committed by Alexandre Julliard
parent 841f158d81
commit b285c5706e
2 changed files with 32 additions and 2 deletions

View File

@ -29,6 +29,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
BOOL disabled; BOOL disabled;
BOOL noActivate; BOOL noActivate;
BOOL floating; BOOL floating;
BOOL pendingMinimize;
WineWindow* latentParentWindow; WineWindow* latentParentWindow;
void* hwnd; void* hwnd;

View File

@ -636,10 +636,16 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
} }
[self setCollectionBehavior:behavior]; [self setCollectionBehavior:behavior];
pendingMinimize = FALSE;
if (state->minimized && ![self isMiniaturized]) if (state->minimized && ![self isMiniaturized])
{ {
ignore_windowMiniaturize = TRUE; if ([self isVisible])
[self miniaturize:nil]; {
ignore_windowMiniaturize = TRUE;
[self miniaturize:nil];
}
else
pendingMinimize = TRUE;
} }
else if (!state->minimized && [self isMiniaturized]) else if (!state->minimized && [self isMiniaturized])
{ {
@ -754,6 +760,13 @@ - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next
if (needAdjustWindowLevels) if (needAdjustWindowLevels)
[controller adjustWindowLevels]; [controller adjustWindowLevels];
if (pendingMinimize)
{
ignore_windowMiniaturize = TRUE;
[self miniaturize:nil];
pendingMinimize = FALSE;
}
NSEnableScreenUpdates(); NSEnableScreenUpdates();
/* Cocoa may adjust the frame when the window is ordered onto the screen. /* Cocoa may adjust the frame when the window is ordered onto the screen.
@ -770,6 +783,8 @@ - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next
- (void) doOrderOut - (void) doOrderOut
{ {
if ([self isMiniaturized])
pendingMinimize = TRUE;
self.latentParentWindow = [self parentWindow]; self.latentParentWindow = [self parentWindow];
[latentParentWindow removeChildWindow:self]; [latentParentWindow removeChildWindow:self];
[self orderOut:nil]; [self orderOut:nil];
@ -948,6 +963,13 @@ - (void) makeFocused:(BOOL)activate
[self orderFront:nil]; [self orderFront:nil];
[controller adjustWindowLevels]; [controller adjustWindowLevels];
if (pendingMinimize)
{
ignore_windowMiniaturize = TRUE;
[self miniaturize:nil];
pendingMinimize = FALSE;
}
NSEnableScreenUpdates(); NSEnableScreenUpdates();
causing_becomeKeyWindow = TRUE; causing_becomeKeyWindow = TRUE;
@ -1057,6 +1079,13 @@ - (void) makeKeyAndOrderFront:(id)sender
[self setLevel:[front level]]; [self setLevel:[front level]];
[self orderFront:nil]; [self orderFront:nil];
[controller adjustWindowLevels]; [controller adjustWindowLevels];
if (pendingMinimize)
{
ignore_windowMiniaturize = TRUE;
[self miniaturize:nil];
pendingMinimize = FALSE;
}
} }
- (void) sendEvent:(NSEvent*)event - (void) sendEvent:(NSEvent*)event