diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 3a80f1df4bd..fb9edc2a322 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -1745,7 +1745,23 @@ - (void) handleMouseButton:(NSEvent*)theEvent if (windowBroughtForward) { - [[windowBroughtForward ancestorWineWindow] postBroughtForwardEvent]; + WineWindow* ancestor = [windowBroughtForward ancestorWineWindow]; + NSInteger ancestorNumber = [ancestor windowNumber]; + NSInteger ancestorLevel = [ancestor level]; + + for (NSNumber* windowNumberObject in [NSWindow windowNumbersWithOptions:0]) + { + NSInteger windowNumber = [windowNumberObject integerValue]; + if (windowNumber == ancestorNumber) + break; + WineWindow* otherWindow = (WineWindow*)[NSApp windowWithWindowNumber:windowNumber]; + if ([otherWindow isKindOfClass:[WineWindow class]] && [otherWindow screen] && + [otherWindow level] <= ancestorLevel && otherWindow == [otherWindow ancestorWineWindow]) + { + [ancestor postBroughtForwardEvent]; + break; + } + } if (!process && ![windowBroughtForward isKeyWindow] && !windowBroughtForward.disabled && !windowBroughtForward.noActivate) [self windowGotFocus:windowBroughtForward]; }