winemac: Don't bring owned windows to the front when they're clicked.

Cocoa will bring an unowned window to the front of its level when it's clicked,
but it doesn't do that for owned windows.  The old code went out of its way to
make owned windows behave like unowned windows in this respect.  That was
exactly backward.  We wish we could control whether windows are raised on a
click.  We don't have that opportunity for unowned windows, but, by ripping
out a bunch of code, we do for owned windows.
This commit is contained in:
Ken Thomases 2014-05-07 17:09:29 -05:00 committed by Alexandre Julliard
parent 3ebb9b7b75
commit 3bca22a6b9

View file

@ -1597,60 +1597,6 @@ - (void) handleMouseButton:(NSEvent*)theEvent
}
}
}
if (broughtWindowForward)
{
// Clicking on a child window does not normally reorder it with
// respect to its siblings, but we want it to. We have to do it
// manually.
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.
[[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;
}
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();
}
}
}
if ([windowsBeingDragged count])