macOS: Don't raise the parent top-level window when raising a child window, only raise the child window to the top of the parent

This commit is contained in:
Sam Lantinga 2023-08-30 20:29:57 -07:00
parent a5e7214795
commit a7eea9997d
1 changed files with 14 additions and 13 deletions

View File

@ -2170,16 +2170,17 @@ void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
if (SDL_WINDOW_IS_POPUP(window)) {
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
}
if (bActivate) {
[nswindow makeKeyAndOrderFront:nil];
} else {
/* Order this window below the key window if we're not activating it */
if ([NSApp keyWindow]) {
[nswindow orderWindow:NSWindowBelow relativeTo:[[NSApp keyWindow] windowNumber]];
if (bActivate) {
[nswindow makeKeyAndOrderFront:nil];
} else {
/* Order this window below the key window if we're not activating it */
if ([NSApp keyWindow]) {
[nswindow orderWindow:NSWindowBelow relativeTo:[[NSApp keyWindow] windowNumber]];
}
}
[nswindow setIsVisible:YES];
}
[nswindow setIsVisible:YES];
[windowData.listener resumeVisibleObservation];
}
}
@ -2234,13 +2235,13 @@ void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
if (SDL_WINDOW_IS_POPUP(window)) {
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
}
if (bActivate) {
[NSApp activateIgnoringOtherApps:YES];
[nswindow makeKeyAndOrderFront:nil];
} else {
[nswindow orderFront:nil];
if (bActivate) {
[NSApp activateIgnoringOtherApps:YES];
[nswindow makeKeyAndOrderFront:nil];
} else {
[nswindow orderFront:nil];
}
}
}
[windowData.listener resumeVisibleObservation];