From: Po Lu Date: Sun, 2 Oct 2022 00:28:56 +0000 (+0800) Subject: Only rely on EWMH window activation if possible X-Git-Tag: emacs-29.0.90~1856^2~88 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3924fbd0257a53e10502d6cdee32616fbe26f0c2;p=emacs.git 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. --- diff --git a/src/xterm.c b/src/xterm.c index 947cf7edb54..d83b03d1ca6 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); } }