Function: window--resize-root-window-vertically

window--resize-root-window-vertically is a byte-compiled function defined in window.el.gz.

Signature

(window--resize-root-window-vertically WINDOW DELTA PIXELWISE)

Documentation

Resize root window WINDOW vertically by DELTA lines.

If DELTA is less than zero and we can't shrink WINDOW by DELTA lines, shrink it as much as possible. If DELTA is greater than zero, this function can resize fixed-size windows in order to recover the necessary lines. Return the number of lines that were recovered.

Third argument PIXELWISE non-nil means to interpret DELTA as pixels and return the number of pixels that were recovered.

This function is called by the minibuffer window resizing routines.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun window--resize-root-window-vertically (window delta pixelwise)
  "Resize root window WINDOW vertically by DELTA lines.
If DELTA is less than zero and we can't shrink WINDOW by DELTA
lines, shrink it as much as possible.  If DELTA is greater than
zero, this function can resize fixed-size windows in order to
recover the necessary lines.  Return the number of lines that
were recovered.

Third argument PIXELWISE non-nil means to interpret DELTA as
pixels and return the number of pixels that were recovered.

This function is called by the minibuffer window resizing
routines."
  (let* ((frame (window-frame window))
	 (pixel-delta
	  (cond
	   (pixelwise
	    delta)
	   ((numberp delta)
	    (* (frame-char-height frame) delta))
	   (t 0)))
	 ignore)
    (cond
     ((zerop pixel-delta))
     ((< pixel-delta 0)
      (setq pixel-delta (window-sizable window pixel-delta nil nil pixelwise))
      (window--resize-reset frame)
      ;; When shrinking the root window, emulate an edge drag in order
      ;; to not resize other windows if we can avoid it (Bug#12419).
      (window--resize-this-window
       window pixel-delta nil ignore t 'before
       (+ (window-pixel-top window) (window-pixel-height window)))
      ;; Don't record new normal sizes to make sure that shrinking back
      ;; proportionally works as intended.
      (walk-window-tree
       (lambda (window) (set-window-new-normal window 'ignore)) frame t))
     ((> pixel-delta 0)
      (window--resize-reset frame)
      (unless (window-sizable window pixel-delta nil nil pixelwise)
	(setq ignore t))
      ;; When growing the root window, resize proportionally.  This
      ;; should give windows back their original sizes (hopefully).
      (window--resize-this-window
       window pixel-delta nil ignore t)))
     ;; Return the possibly adjusted DELTA.
     (if pixelwise
	 pixel-delta
       (/ pixel-delta (frame-char-height frame)))))