Commit d14f7871 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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).
parent 2c31fce1
...@@ -1480,10 +1480,30 @@ int macdrv_err_on; ...@@ -1480,10 +1480,30 @@ int macdrv_err_on;
// respect to its siblings, but we want it to. We have to do it // respect to its siblings, but we want it to. We have to do it
// manually. // manually.
NSWindow* parent = [window parentWindow]; NSWindow* parent = [window parentWindow];
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 removeChildWindow:window];
[parent addChildWindow:window ordered:NSWindowAbove]; [parent addChildWindow:window ordered:NSWindowAbove];
} }
} }
}
if (mouseCaptureWindow) if (mouseCaptureWindow)
window = mouseCaptureWindow; window = mouseCaptureWindow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment