emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3924fbd025: Only rely on EWMH window activation if possible


From: Po Lu
Subject: master 3924fbd025: Only rely on EWMH window activation if possible
Date: Sat, 1 Oct 2022 20:29:22 -0400 (EDT)

branch: master
commit 3924fbd0257a53e10502d6cdee32616fbe26f0c2
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Only rely on EWMH window activation if possible
    
    * xterm.c (x_ewmh_activate_frame): Remove unnecessary
    x_wm_supports check.
    (x_focus_frame): When the window manager supports
    _NET_ACTIVE_WINDOW, just use it; anything else may confuse the
    window manager.
---
 src/xterm.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 947cf7edb5..d83b03d1ca 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -26842,8 +26842,7 @@ x_ewmh_activate_frame (struct frame *f)
 
   dpyinfo = FRAME_DISPLAY_INFO (f);
 
-  if (FRAME_VISIBLE_P (f)
-      && x_wm_supports (f, dpyinfo->Xatom_net_active_window))
+  if (FRAME_VISIBLE_P (f))
     {
       /* See the documentation at
         https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html
@@ -26903,14 +26902,23 @@ x_focus_frame (struct frame *f, bool noactivate)
     xembed_request_focus (f);
   else
     {
+      if (!noactivate
+         && x_wm_supports (f, dpyinfo->Xatom_net_active_window))
+       {
+         /* When window manager activation is possible, use it
+            instead.  The window manager is expected to perform any
+            necessary actions such as raising the frame, moving it to
+            the current workspace, and mapping it, etc, before moving
+            input focus to the frame.  */
+         x_ewmh_activate_frame (f);
+         return;
+       }
+
       /* Ignore any BadMatch error this request might result in.  */
       x_ignore_errors_for_next_request (dpyinfo);
       XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                      RevertToParent, CurrentTime);
       x_stop_ignoring_errors (dpyinfo);
-
-      if (!noactivate)
-       x_ewmh_activate_frame (f);
     }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]