Skip to content

Commit

Permalink
fix: child window alwaysOnTop level
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jun 21, 2021
1 parent 507cbdc commit f644f62
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions shell/browser/native_window_mac.mm
Expand Up @@ -1795,8 +1795,8 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
NativeWindow::SetParentWindow(parent);

// Do not remove/add if we are already properly attached.
if (attach && parent &&
[window_ parentWindow] == parent->GetNativeWindow().GetNativeNSWindow())
auto* native_window = parent->GetNativeWindow().GetNativeNSWindow();
if (attach && parent && [window_ parentWindow] == native_window)
return;

// Remove current parent window.
Expand All @@ -1805,10 +1805,13 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {

// Set new parent window.
// Note that this method will force the window to become visible.
if (parent && attach)
[parent->GetNativeWindow().GetNativeNSWindow()
addChildWindow:window_
ordered:NSWindowAbove];
if (parent && attach) {
// Attaching a window as a child window resets its window level, so
// save and restore it afterwards.
NSInteger level = window_.level;
[native_window addChildWindow:window_ ordered:NSWindowAbove];
[window_ setLevel:level];
}
}

void NativeWindowMac::SetForwardMouseMessages(bool forward) {
Expand Down

0 comments on commit f644f62

Please sign in to comment.