about summary refs log tree commit diff
path: root/exwm-layout.el
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2022-11-22T00·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2022-11-22T00·00+0000
commitb62d5e79b0c1799f2cd941b4cec5bf8492cb322c (patch)
tree4736b634f05ef731654de5fc55586a042de2bb30 /exwm-layout.el
parent1c706daeb089d8f9c50eeecb898cad6336f0e3e6 (diff)
Use `active-minibuffer-window' rather than `minibuffer-window'
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use
`active-minibuffer-window`, instead of the minibuffer window of
selected frame, as there's no guarantee that the selected frame is
the frame containing the minibuffer.  Also make sure the frame is
an EXWM workspace.
Diffstat (limited to 'exwm-layout.el')
-rw-r--r--exwm-layout.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/exwm-layout.el b/exwm-layout.el
index 3d78b4265539..ea186fe5a451 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -403,21 +403,22 @@ selected by `other-buffer'."
 (defun exwm-layout--on-minibuffer-setup ()
   "Refresh layout when minibuffer grows."
   (exwm--log)
-  ;; Only when the minibuffer's frame is an EXWM frame.
-  ;; FIXME: would it be enough checking for workspace frames?
-  (when (exwm--terminal-p)
-    (exwm--defer 0 (lambda ()
-                     (when (< 1 (window-height (minibuffer-window)))
-                       (exwm-layout--refresh))))))
+  ;; Only when active minibuffer's frame is an EXWM frame.
+  (let* ((mini-window (active-minibuffer-window))
+         (frame (window-frame mini-window)))
+    (when (exwm-workspace--workspace-p frame)
+      (exwm--defer 0 (lambda ()
+                       (when (< 1 (window-height mini-window)))
+                       (exwm-layout--refresh frame))))))
 
 (defun exwm-layout--on-echo-area-change (&optional dirty)
   "Run when message arrives or in `echo-area-clear-hook' to refresh layout."
-  (let ((frame (window-frame (minibuffer-window)))
+  (let ((frame (window-frame (active-minibuffer-window)))
         (msg (current-message)))
     ;; Check whether the frame where current window's minibuffer resides (not
     ;; current window's frame for floating windows!) must be adjusted.
     (when (and msg
-               (exwm--terminal-p frame)
+               (exwm-workspace--workspace-p frame)
                (or (cl-position ?\n msg)
                    (> (length msg) (frame-width frame))))
       (exwm--log)