winemac: Fix hiding windows that are minimized using -close instead of -orderOut:.

Cocoa won't order a minimized window out of the screen list using -orderOut:.
This leaves a window that should be hidden still visible in the Dock, where
it can be unminimized.
This commit is contained in:
Ken Thomases 2013-09-26 23:46:31 -05:00 committed by Alexandre Julliard
parent f78ffb374d
commit d7f4d67514
3 changed files with 16 additions and 2 deletions

View File

@ -1809,6 +1809,8 @@ - (void) setupObservations
queue:[NSOperationQueue mainQueue] queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note){ usingBlock:^(NSNotification *note){
NSWindow* window = [note object]; NSWindow* window = [note object];
if ([window isKindOfClass:[WineWindow class]] && [(WineWindow*)window isFakingClose])
return;
[keyWindows removeObjectIdenticalTo:window]; [keyWindows removeObjectIdenticalTo:window];
if (window == lastTargetWindow) if (window == lastTargetWindow)
lastTargetWindow = nil; lastTargetWindow = nil;

View File

@ -60,6 +60,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
BOOL ignore_windowMiniaturize; BOOL ignore_windowMiniaturize;
BOOL ignore_windowDeminiaturize; BOOL ignore_windowDeminiaturize;
BOOL fakingClose;
} }
@property (retain, readonly, nonatomic) WineEventQueue* queue; @property (retain, readonly, nonatomic) WineEventQueue* queue;
@ -67,6 +68,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
@property (readonly, nonatomic) BOOL noActivate; @property (readonly, nonatomic) BOOL noActivate;
@property (readonly, nonatomic) BOOL floating; @property (readonly, nonatomic) BOOL floating;
@property (readonly, getter=isFullscreen, nonatomic) BOOL fullscreen; @property (readonly, getter=isFullscreen, nonatomic) BOOL fullscreen;
@property (readonly, getter=isFakingClose, nonatomic) BOOL fakingClose;
- (NSInteger) minimumLevelForActive:(BOOL)active; - (NSInteger) minimumLevelForActive:(BOOL)active;
- (void) updateFullscreen; - (void) updateFullscreen;

View File

@ -139,6 +139,7 @@ @interface WineWindow ()
@property (readwrite, nonatomic) BOOL disabled; @property (readwrite, nonatomic) BOOL disabled;
@property (readwrite, nonatomic) BOOL noActivate; @property (readwrite, nonatomic) BOOL noActivate;
@property (readwrite, nonatomic) BOOL floating; @property (readwrite, nonatomic) BOOL floating;
@property (readwrite, getter=isFakingClose, nonatomic) BOOL fakingClose;
@property (retain, nonatomic) NSWindow* latentParentWindow; @property (retain, nonatomic) NSWindow* latentParentWindow;
@property (nonatomic) void* hwnd; @property (nonatomic) void* hwnd;
@ -466,7 +467,7 @@ @implementation WineWindow
static WineWindow* causing_becomeKeyWindow; static WineWindow* causing_becomeKeyWindow;
@synthesize disabled, noActivate, floating, fullscreen, latentParentWindow, hwnd, queue; @synthesize disabled, noActivate, floating, fullscreen, fakingClose, latentParentWindow, hwnd, queue;
@synthesize surface, surface_mutex; @synthesize surface, surface_mutex;
@synthesize shape, shapeChangedSinceLastDraw; @synthesize shape, shapeChangedSinceLastDraw;
@synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue; @synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue;
@ -497,6 +498,7 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w
[window setHidesOnDeactivate:NO]; [window setHidesOnDeactivate:NO];
[window setReleasedWhenClosed:NO]; [window setReleasedWhenClosed:NO];
[window setOneShot:YES];
[window disableCursorRects]; [window disableCursorRects];
[window setShowsResizeIndicator:NO]; [window setShowsResizeIndicator:NO];
[window setHasShadow:wf->shadow]; [window setHasShadow:wf->shadow];
@ -1039,6 +1041,13 @@ - (void) doOrderOut
pendingMinimize = TRUE; pendingMinimize = TRUE;
[self becameIneligibleParentOrChild]; [self becameIneligibleParentOrChild];
if ([self isMiniaturized])
{
fakingClose = TRUE;
[self close];
fakingClose = FALSE;
}
else
[self orderOut:nil]; [self orderOut:nil];
if (wasVisible && wasOnActiveSpace && fullscreen) if (wasVisible && wasOnActiveSpace && fullscreen)
[controller updateFullscreenWindows]; [controller updateFullscreenWindows];
@ -1548,6 +1557,7 @@ - (void) windowWillClose:(NSNotification*)notification
{ {
WineWindow* child; WineWindow* child;
if (fakingClose) return;
if (latentParentWindow) if (latentParentWindow)
{ {
[latentParentWindow->latentChildWindows removeObjectIdenticalTo:self]; [latentParentWindow->latentChildWindows removeObjectIdenticalTo:self];