unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31440: Can't redefine parent-frame on NS
@ 2018-05-13  9:40 Alan Third
  2018-06-03 19:34 ` Alan Third
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Third @ 2018-05-13  9:40 UTC (permalink / raw)
  To: 31440

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#31440: Can't redefine parent-frame on NS
  2018-05-13  9:40 bug#31440: Can't redefine parent-frame on NS Alan Third
@ 2018-06-03 19:34 ` Alan Third
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Third @ 2018-06-03 19:34 UTC (permalink / raw)
  To: 31440-done

Alan Third <alan@idiocy.org> writes:

> 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.

Pushed to Emacs 26.2.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-03 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-13  9:40 bug#31440: Can't redefine parent-frame on NS Alan Third
2018-06-03 19:34 ` Alan Third

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).