winemac.drv: Force a window in front of its peers if its level is decreased.

Working around a macOS bug: -setLevel: is documented to move a window
in front of its new peers, but that doesn't happen on Ventura.
This commit is contained in:
Tim Clem 2023-05-05 10:02:07 -07:00 committed by Alexandre Julliard
parent e6b21cc577
commit 222d20a585

View file

@ -633,18 +633,24 @@ - (void) adjustWindowLevels:(BOOL)active
{
[window setLevel:newLevel];
// -setLevel: puts the window at the front of its new level. If
// we decreased the level, that's good (it was in front of that
// level before, so it should still be now). But if we increased
// the level, the window should be toward the back (but still
// ahead of the previous windows we did this to).
if (origLevel < newLevel)
{
// If we increased the level, the window should be toward the
// back of its new level (but still ahead of the previous
// windows we did this to).
if (prev)
[window orderWindow:NSWindowAbove relativeTo:[prev windowNumber]];
else
[window orderBack:nil];
}
else
{
// If we decreased the level, we want the window at the top
// of its new level. -setLevel: is documented to do that on
// its own, but that's buggy on Ventura. Since we're looping
// back-to-front here, -orderFront: will do the right thing.
[window orderFront:nil];
}
}
prev = window;