winemac: On click, don't reorder Cocoa child window after siblings of higher level.
It may be necessary to reorder to some extent because the clicked window is behind a sibling at the same level, but that shouldn't move it later in the list than higher-level siblings. Cocoa gets buggy if the list of child windows isn't in z-order.
This commit is contained in:
parent
d14f787192
commit
b550ee8d59
|
@ -1482,6 +1482,7 @@ - (void) handleMouseButton:(NSEvent*)theEvent
|
|||
NSWindow* parent = [window parentWindow];
|
||||
NSInteger level = [window level];
|
||||
__block BOOL needReorder = FALSE;
|
||||
NSMutableArray* higherLevelSiblings = [NSMutableArray array];
|
||||
|
||||
// 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.
|
||||
|
@ -1495,12 +1496,35 @@ - (void) handleMouseButton:(NSEvent*)theEvent
|
|||
needReorder = TRUE;
|
||||
*stop = TRUE;
|
||||
}
|
||||
else
|
||||
[higherLevelSiblings insertObject:child atIndex:0];
|
||||
}];
|
||||
|
||||
if (needReorder)
|
||||
{
|
||||
WineWindow* sibling;
|
||||
|
||||
NSDisableScreenUpdates();
|
||||
|
||||
[parent removeChildWindow:window];
|
||||
for (sibling in higherLevelSiblings)
|
||||
[parent removeChildWindow:sibling];
|
||||
|
||||
[parent addChildWindow:window ordered:NSWindowAbove];
|
||||
for (sibling in higherLevelSiblings)
|
||||
{
|
||||
// Setting a window as a child can reset its level to be
|
||||
// the same as the parent, so save it and restore it.
|
||||
// The call to -setLevel: puts the window at the front
|
||||
// of its level but testing shows that that's what Cocoa
|
||||
// does when you click on any window in an ownership
|
||||
// hierarchy, anyway.
|
||||
level = [sibling level];
|
||||
[parent addChildWindow:sibling ordered:NSWindowAbove];
|
||||
[sibling setLevel:level];
|
||||
}
|
||||
|
||||
NSEnableScreenUpdates();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue