emacs-31 7b812bc38aa: Don't use window manager activation when a child frame has focus (Bug#81326)

Martin Rudalics via Mailing list for Emacs changes <[email protected]> Tue, 30 Jun 2026 03:19:33 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 7b812bc38aa180532480e2eff54bdbd434a9881a
Author: Martin Rudalics <[email protected]>
Commit: Martin Rudalics <[email protected]>

    Don't use window manager activation when a child frame has focus (Bug#81326)
    
    * src/xterm.c (x_get_toplevel_parent): Remove.
    (x_focus_frame): Never call x_ewmh_activate_frame when a child
    frame has focus (Bug#81326).
---
 src/xterm.c | 25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index bc654952360..a1513d99f2d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -28926,25 +28926,6 @@ x_get_focus_frame (struct frame *f)
   return lisp_focus;
 }
 
-/* Return the toplevel parent of F, if it is a child frame.
-   Otherwise, return NULL.  */
-
-static struct frame *
-x_get_toplevel_parent (struct frame *f)
-{
-  struct frame *parent;
-
-  if (!FRAME_PARENT_FRAME (f))
-    return NULL;
-
-  parent = FRAME_PARENT_FRAME (f);
-
-  while (FRAME_PARENT_FRAME (parent))
-    parent = FRAME_PARENT_FRAME (parent);
-
-  return parent;
-}
-
 static void
 x_set_input_focus (struct x_display_info *dpyinfo, Window window,
 		   Time time)
@@ -29068,11 +29049,9 @@ x_focus_frame (struct frame *f, bool noactivate)
 	     may not work if its parent is not activated.  */
 	  && !FRAME_PARENT_FRAME (f)
 	  /* If the focus is being transferred from a child frame to
-	     its toplevel parent, also use SetInputFocus.  */
+	     another frame, also use SetInputFocus.  */
 	  && (!dpyinfo->x_focus_frame
-	      || (x_get_toplevel_parent (dpyinfo->x_focus_frame)
-		  != f))
-	  && x_wm_supports (f, dpyinfo->Xatom_net_active_window))
+	      || !FRAME_PARENT_FRAME (dpyinfo->x_focus_frame)))
 	{
 	  /* When window manager activation is possible, use it
 	     instead.  The window manager is expected to perform any