Module: wine
Branch: master
Commit: 222d20a585c454cb591e3dc539f3bd52427ea30c
URL: https://gitlab.winehq.org/wine/wine/-/commit/222d20a585c454cb591e3dc539f3bd…
Author: Tim Clem <tclem(a)codeweavers.com>
Date: Fri May 5 10:02:07 2023 -0700
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.
---
dlls/winemac.drv/cocoa_app.m | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index d9d56da20f8..6a16d1ba832 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -633,18 +633,24 @@ static NSString* WineLocalizedString(unsigned int stringID)
{
[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;