>From a33d6248a7369fc18111e42b6157a6bf84c5578a Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 13 May 2018 10:33:44 +0100 Subject: [PATCH] Fix redefinition of child frames on NS * src/nsterm.m (x_set_parent_frame): If the NSWindow has an existing parent frame, remove it. --- src/nsterm.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index c8ae31abc0..df883346de 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1958,12 +1958,20 @@ so some key presses (TAB) are swallowed by the system. */ if (p != FRAME_PARENT_FRAME (f)) { - parent = [FRAME_NS_VIEW (p) window]; + block_input (); child = [FRAME_NS_VIEW (f) window]; - block_input (); - [parent addChildWindow: child - ordered: NSWindowAbove]; + if ([child parentWindow] != nil) + [[child parentWindow] removeChildWindow:child]; + + if (!NILP (new_value)) + { + parent = [FRAME_NS_VIEW (p) window]; + + [parent addChildWindow: child + ordered: NSWindowAbove]; + } + unblock_input (); fset_parent_frame (f, new_value); -- 2.16.1