]> git.eshelyaron.com Git - emacs.git/commitdiff
Do not raise a different frame when closing a frame
authorDaniel Martín <mardani29@yahoo.es>
Fri, 18 Aug 2023 13:03:21 +0000 (15:03 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 26 Aug 2023 08:03:59 +0000 (11:03 +0300)
* src/frame.h: Declare an NS-only function to make a frame the
key window.
* src/nsfns.m (ns_make_frame_key_window): Implement it.
* src/frame.c (delete_frame): Call ns_make_frame_key_window
instead of Fraise_frame.  (Bug#61525)

src/frame.c
src/frame.h
src/nsfns.m

index 4be9f06bd3cab3ba45d4706886df11d04daf55cf..38ac316ce87d959f31927d72737da5a71d2fc58e 100644 (file)
@@ -2212,12 +2212,15 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
        }
 #ifdef NS_IMPL_COCOA
       else
-       /* Under NS, there is no system mechanism for choosing a new
-          window to get focus -- it is left to application code.
-          So the portion of THIS application interfacing with NS
-          needs to know about it.  We call Fraise_frame, but the
-          purpose is really to transfer focus.  */
-       Fraise_frame (frame1);
+       {
+         /* Under NS, there is no system mechanism for choosing a new
+            window to get focus -- it is left to application code.
+            So the portion of THIS application interfacing with NS
+            needs to make the frame we switch to the key window.  */
+         struct frame *f1 = XFRAME (frame1);
+         if (FRAME_NS_P (f1))
+           ns_make_frame_key_window (f1);
+       }
 #endif
 
       do_switch_frame (frame1, 0, 1, Qnil);
index c85df378da62e294950b7abc10554ac7b2d70d3e..f4726f1c0e53be042b00edf45d9078234971d6d0 100644 (file)
@@ -1521,6 +1521,10 @@ extern Lisp_Object mouse_position (bool);
 extern void frame_size_history_plain (struct frame *, Lisp_Object);
 extern void frame_size_history_extra (struct frame *, Lisp_Object,
                                      int, int, int, int, int, int);
+#ifdef NS_IMPL_COCOA
+/* Implemented in nsfns.m.  */
+extern void ns_make_frame_key_window (struct frame *);
+#endif
 extern Lisp_Object Vframe_list;
 
 /* Value is a pointer to the selected frame.  If the selected frame
index b846b490ff78e82e93e2485299dec57ce88789a2..a79892f73b667a6d3c637b9f88a6b51ac649393d 100644 (file)
@@ -685,6 +685,12 @@ ns_change_tab_bar_height (struct frame *f, int height)
   SET_FRAME_GARBAGED (f);
 }
 
+void
+ns_make_frame_key_window (struct frame *f)
+{
+  [[FRAME_NS_VIEW (f) window] makeKeyWindow];
+}
+
 /* tabbar support */
 static void
 ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)