about summary refs log tree commit diff
path: root/exwm-workspace.el
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-02-06T21·43+0100
committerFelix Lange <fjl@twurst.com>2016-02-06T21·43+0100
commit00065234749054940563f59a0027a53bc5ebffad (patch)
tree5215c9f0965cc3c7e94cd39b14b39de30a9af26c /exwm-workspace.el
parent97daba20ad22f05f2e4c1347ff86d6c957142a0a (diff)
Resize minibuffer only when it's in its own frame
0e4055d3392 introduced a few calls to exwm-workspace--resize-minibuffer
in various places. This function only works when the minibuffer is
displayed in its own frame but was called unconditionally in some cases.

Fix it by wrapping all calls in an appropriate conditional and add an
assertion. Also rename the function so it is clearer that it resizes a
frame, which might prevent calling it unconditionally in the future.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r--exwm-workspace.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 1c23ca0229..b166733ac6 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -111,11 +111,16 @@ Value nil means to use the default position which is fixed at bottom, while
 (defvar exwm-workspace--display-echo-area-timer nil
   "Timer for auto-hiding echo area.")
 
-(defun exwm-workspace--resize-minibuffer (&optional width height)
+(defun exwm-workspace--minibuffer-own-frame-p ()
+  "Reports whether the minibuffer is displayed in its own frame."
+  (memq exwm-workspace-minibuffer-position '(top bottom)))
+
+(defun exwm-workspace--resize-minibuffer-frame (&optional width height)
   "Resize minibuffer (and its container) to fit the size of workspace.
 
 If WIDTH and HEIGHT of the workspace is not specified, they're get from the
 workspace frame."
+  (cl-assert (exwm-workspace--minibuffer-own-frame-p))
   (let ((y (if (eq exwm-workspace-minibuffer-position 'top)
                0
              (- (or height (frame-pixel-height exwm-workspace--current))
@@ -168,7 +173,7 @@ The optional FORCE option is for internal use only."
         ;; Close the (possible) active minibuffer
         (when (active-minibuffer-window)
           (run-with-idle-timer 0 nil (lambda () (abort-recursive-edit))))
-        (if (not (memq exwm-workspace-minibuffer-position '(top bottom)))
+        (if (not (exwm-workspace--minibuffer-own-frame-p))
             (setq default-minibuffer-frame frame)
           ;; Resize/reposition the minibuffer frame
           (xcb:+request exwm--connection
@@ -178,7 +183,7 @@ The optional FORCE option is for internal use only."
                                               'exwm-container)
                              :parent (frame-parameter frame 'exwm-workspace)
                              :x 0 :y 0))
-          (exwm-workspace--resize-minibuffer))
+          (exwm-workspace--resize-minibuffer-frame))
         ;; Hide windows in other workspaces by preprending a space
         (unless exwm-workspace-show-all-buffers
           (dolist (i exwm--id-buffer-alist)
@@ -459,7 +464,7 @@ This functions is modified from `display-buffer-reuse-window' and
             (0 (y-or-n-p prompt))
             (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
                                     x (if (= x 1) "" "s") prompt))))))
-  (if (not (memq exwm-workspace-minibuffer-position '(top bottom)))
+  (if (not (exwm-workspace--minibuffer-own-frame-p))
       ;; Initialize workspaces with minibuffers.
       (progn
         (setq exwm-workspace--list (frame-list))