From 222d20a585c454cb591e3dc539f3bd52427ea30c Mon Sep 17 00:00:00 2001 From: Tim Clem Date: Fri, 5 May 2023 10:02:07 -0700 Subject: [PATCH] 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 @@ - (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;