winemac: Set up window's latent parent-child relationship before ordering the window.

Making a window a child reorders it to be immediately above or below its parent,
potentially undoing the ordering we had just done.
This commit is contained in:
Ken Thomases 2013-05-16 18:43:31 -05:00 committed by Alexandre Julliard
parent 0d4a26eff5
commit 8343e7ce4d
1 changed files with 13 additions and 13 deletions

View File

@ -697,6 +697,14 @@ - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next
{
[controller transformProcessToForeground];
if (latentParentWindow)
{
if ([latentParentWindow level] > [self level])
[self setLevelWhenActive:[latentParentWindow level]];
[latentParentWindow addChildWindow:self ordered:NSWindowAbove];
[controller wineWindow:self ordered:NSWindowAbove relativeTo:latentParentWindow];
self.latentParentWindow = nil;
}
if (prev)
{
/* Make sure that windows that should be above this one really are.
@ -728,14 +736,6 @@ - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next
[self orderWindow:NSWindowAbove relativeTo:[next windowNumber]];
[controller wineWindow:self ordered:NSWindowAbove relativeTo:next];
}
if (latentParentWindow)
{
if ([latentParentWindow level] > [self level])
[self setLevelWhenActive:[latentParentWindow level]];
[latentParentWindow addChildWindow:self ordered:NSWindowAbove];
[controller wineWindow:self ordered:NSWindowAbove relativeTo:latentParentWindow];
self.latentParentWindow = nil;
}
/* Cocoa may adjust the frame when the window is ordered onto the screen.
Generate a frame-changed event just in case. The back end will ignore
@ -922,11 +922,6 @@ - (void) makeFocused:(BOOL)activate
}
if (activate)
[NSApp activateIgnoringOtherApps:YES];
[self orderFront:nil];
[controller wineWindow:self ordered:NSWindowAbove relativeTo:nil];
causing_becomeKeyWindow = TRUE;
[self makeKeyWindow];
causing_becomeKeyWindow = FALSE;
if (latentParentWindow)
{
if ([latentParentWindow level] > [self level])
@ -935,6 +930,11 @@ - (void) makeFocused:(BOOL)activate
[controller wineWindow:self ordered:NSWindowAbove relativeTo:latentParentWindow];
self.latentParentWindow = nil;
}
[self orderFront:nil];
[controller wineWindow:self ordered:NSWindowAbove relativeTo:nil];
causing_becomeKeyWindow = TRUE;
[self makeKeyWindow];
causing_becomeKeyWindow = FALSE;
if (![self isExcludedFromWindowsMenu])
[NSApp addWindowsItem:self title:[self title] filename:NO];