Module: wine
Branch: master
Commit: d14f787192c66a5d339c60fb1bcdb849c1eefa67
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d14f787192c66a5d339c60fb1…
Author: Ken Thomases <ken(a)codeweavers.com>
Date: Fri Aug 30 00:00:35 2013 -0500
winemac: Don't reorder clicked window relative to sibling owned windows if it's in the right place.
The right place may not be the end of the list of Cocoa child windows if some
of the siblings are at a higher window level (i.e. floating if the clicked
window is not).
---
dlls/winemac.drv/cocoa_app.m | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 8de68bb..4cb09e7 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1480,8 +1480,28 @@ int macdrv_err_on;
// respect to its siblings, but we want it to. We have to do it
// manually.
NSWindow* parent = [window parentWindow];
- [parent removeChildWindow:window];
- [parent addChildWindow:window ordered:NSWindowAbove];
+ NSInteger level = [window level];
+ __block BOOL needReorder = FALSE;
+
+ // If the window is already the last child or if it's only below
+ // children with higher window level, then no need to reorder it.
+ [[parent childWindows] enumerateObjectsWithOptions:NSEnumerationReverse
+ usingBlock:^(id obj, NSUInteger idx, BOOL *stop){
+ WineWindow* child = obj;
+ if (child == window)
+ *stop = TRUE;
+ else if ([child level] <= level)
+ {
+ needReorder = TRUE;
+ *stop = TRUE;
+ }
+ }];
+
+ if (needReorder)
+ {
+ [parent removeChildWindow:window];
+ [parent addChildWindow:window ordered:NSWindowAbove];
+ }
}
}