all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: 31440@debbugs.gnu.org
Subject: bug#31440: Can't redefine parent-frame on NS
Date: Sun, 13 May 2018 10:40:54 +0100	[thread overview]
Message-ID: <20180513094054.GA15823@breton.holly.idiocy.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

from emacs -Q:

set up three frames, a, b and c:

    (set-frame-parameter c 'parent-frame a)

c becomes child of a.

(set-frame-parameter c 'parent-frame b)

expected: c becomes child of b and is no longer child of a.

actual: c remains child of a, and b now cannot be raised above a and b.

(set-frame-parameter c 'parent-frame nil)

expected: c ceases to be a child frame.

actual: emacs crashes.



Patch attached.

If this is too late for 26.1 I don’t think that will be a huge issue
as it seems redefining parent-frame is not something people want to
do, and it’s unlikely to be something a user does by accident.
-- 
Alan Third

[-- Attachment #2: 0001-Fix-redefinition-of-child-frames-on-NS.patch --]
[-- Type: text/plain, Size: 1222 bytes --]

From a33d6248a7369fc18111e42b6157a6bf84c5578a Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
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


             reply	other threads:[~2018-05-13  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13  9:40 Alan Third [this message]
2018-06-03 19:34 ` bug#31440: Can't redefine parent-frame on NS Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180513094054.GA15823@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=31440@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.