Fix Mac child windows that are created hidden showing if their parent window is shown
- Child windows are added and removed dynamically from the window hierarchy when they're shown/hidden. Adding a hidden child window to a visible parent is fine, but adding a hidden child window to a hidden parent will cause the child to show when the parent window is shown as it's still a part of the window hierarchy. - For some reason, not adding the child window to the parent entirely causes the child to not focus correctly the first time it's shown. Adding then immediately calling orderOut to remove the child window from the hierarchy does work correctly so we do this to work around the weird issue.
This commit is contained in:
parent
d6b1fc9576
commit
787a15f760
1 changed files with 10 additions and 0 deletions
|
@ -1926,6 +1926,16 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
|
|||
Cocoa_SetKeyboardFocus(window);
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Should not need to call addChildWindow then orderOut.
|
||||
Attaching a hidden child window to a hidden parent window will cause the child window
|
||||
to show when the parent does. We therefore shouldn't attach the child window here as we're
|
||||
going to do so when the child window is explicitly shown later but skipping the addChildWindow
|
||||
entirely causes the child window to not get key focus correctly the first time it's shown. Adding
|
||||
then immediately ordering out (removing) the window does work. */
|
||||
if (window->flags & SDL_WINDOW_HIDDEN) {
|
||||
[nswindow orderOut:nil];
|
||||
}
|
||||
}
|
||||
|
||||
if (nswindow.isOpaque) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue