about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorManuel Giraud <manuel@ledu-giraud.fr>2022-10-12T08·47+0200
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2022-10-29T00·00+0000
commitce2191c444ae29edf669790a1002238b8fc90ac4 (patch)
tree78b4068473d4d8cb8f0f7b6fdb939e89ec9894bc /exwm.el
parente43bd782580fc7f2aa7f5f92da1c5d7c992b6d1c (diff)
Focus workspace frames upon _NET_ACTIVE_WINDOW
* exwm.el (exwm--on-ClientMessage): Take care of focusing
workspace frames when a _NET_ACTIVE_WINDOW message is received for
a workspace frame.  This is responsibility of the window manager
when it advertises _NET_ACTIVE_WINDOW support, which we do.
Emacs versions before 29 took care of setting the input focus to
the frame.

Thanks-to: Po Lu for the work on Emacs and assistance with this
           issue.
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/exwm.el b/exwm.el
index b025f6b49aa5..1bfeb3638a41 100644
--- a/exwm.el
+++ b/exwm.el
@@ -420,8 +420,8 @@
     (setq type (slot-value obj 'type)
           id (slot-value obj 'window)
           data (slot-value (slot-value obj 'data) 'data32))
-    (exwm--log "atom=%s(%s)" (x-get-atom-name type exwm-workspace--current)
-               type)
+    (exwm--log "atom=%s(%s) id=#x%x data=%s" (x-get-atom-name type exwm-workspace--current)
+               type (or id 0) data)
     (cond
      ;; _NET_NUMBER_OF_DESKTOPS.
      ((= type xcb:Atom:_NET_NUMBER_OF_DESKTOPS)
@@ -443,7 +443,8 @@
      ((= type xcb:Atom:_NET_ACTIVE_WINDOW)
       (let ((buffer (exwm--id->buffer id))
             iconic window)
-        (when (buffer-live-p buffer)
+        (if (buffer-live-p buffer)
+          ;; Either an `exwm-mode' buffer (an X window) or a floating frame.
           (with-current-buffer buffer
             (when (eq exwm--frame exwm-workspace--current)
               (if exwm--floating-frame
@@ -457,7 +458,11 @@
                 (setq window (get-buffer-window nil t))
                 (when (or iconic
                           (not (eq window (selected-window))))
-                  (select-window window))))))))
+                  (select-window window)))))
+          ;; A workspace.
+          (dolist (f exwm-workspace--list)
+            (when (eq id (frame-parameter f 'exwm-outer-id))
+              (x-focus-frame f t))))))
      ;; _NET_CLOSE_WINDOW.
      ((= type xcb:Atom:_NET_CLOSE_WINDOW)
       (let ((buffer (exwm--id->buffer id)))