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>2021-12-09T00·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2022-02-01T00·00+0000
commitd6f62ff55aa722456e5fcf2bd8cb431a626347f2 (patch)
treeee2bcf3e77991e1f7bafe0e733e8b787f6a86fdd /exwm-layout.el
parentd4a7d166763077b5d5e81584d765cd48d920ebf0 (diff)
Check EXWM terminal instead of client or graphical frames
* exwm-core.el (exwm--terminal-p): Add function.
* exwm.el (exwm--confirm-kill-terminal): Use it.
* exwm-input.el (exwm-input--on-buffer-list-update): Use it.
(exwm-input--on-minibuffer-setup)
(exwm-input--on-minibuffer-exit): Use it.
(exwm-input--on-minibuffer-exit): Use the minibuffer's selected
window's frame or selected frame instead of current workspace.
(exwm-input--on-echo-area-dirty): Removed test, as it's checked in
`exwm-input--on-minibuffer-setup'.
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use it.
(exwm-layout--on-echo-area-change): Refresh layout the
frame of selected window's minibuffer if it's an EXWM frame.
* exwm-workspace.el (exwm-workspace--update-minibuffer-height)
(exwm-workspace--on-minibuffer-setup)
(exwm-workspace--on-minibuffer-exit)
(exwm-workspace--on-echo-area-dirty)
(exwm-workspace--on-echo-area-clear)
(exwm-workspace--on-delete-frame): Use it.
* exwm-workspace.el (exwm-workspace--client-p-hash-table): Remove
variable.
(exwm-workspace--client-p): Remove function.
Diffstat (limited to 'exwm-layout.el')
-rw-r--r--exwm-layout.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/exwm-layout.el b/exwm-layout.el
index 9173a1c049..3d78b42655 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -57,8 +57,6 @@
 (declare-function exwm-input--grab-keyboard "exwm-input.el")
 (declare-function exwm-input-grab-keyboard "exwm-input.el")
 (declare-function exwm-workspace--active-p "exwm-workspace.el" (frame))
-(declare-function exwm-workspace--client-p "exwm-workspace.el"
-                  (&optional frame))
 (declare-function exwm-workspace--minibuffer-own-frame-p "exwm-workspace.el")
 (declare-function exwm-workspace--workspace-p "exwm-workspace.el"
                   (workspace))
@@ -405,22 +403,27 @@ selected by `other-buffer'."
 (defun exwm-layout--on-minibuffer-setup ()
   "Refresh layout when minibuffer grows."
   (exwm--log)
-  (unless (exwm-workspace--client-p)
+  ;; 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))))))
 
 (defun exwm-layout--on-echo-area-change (&optional dirty)
   "Run when message arrives or in `echo-area-clear-hook' to refresh layout."
-  (when (and (current-message)
-             (not (exwm-workspace--client-p))
-             (or (cl-position ?\n (current-message))
-                 (> (length (current-message))
-                    (frame-width exwm-workspace--current))))
-    (exwm--log)
-    (if dirty
-        (exwm-layout--refresh)
-      (exwm--defer 0 #'exwm-layout--refresh))))
+  (let ((frame (window-frame (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)
+               (or (cl-position ?\n msg)
+                   (> (length msg) (frame-width frame))))
+      (exwm--log)
+      (if dirty
+          (exwm-layout--refresh exwm-workspace--current)
+        (exwm--defer 0 #'exwm-layout--refresh exwm-workspace--current)))))
 
 ;;;###autoload
 (defun exwm-layout-enlarge-window (delta &optional horizontal)