Function: window--pixel-to-total
window--pixel-to-total is a byte-compiled function defined in
window.el.gz.
Signature
(window--pixel-to-total &optional FRAME HORIZONTAL)
Documentation
On FRAME assign new total window heights from pixel heights.
FRAME must be a live frame and defaults to the selected frame.
Optional argument HORIZONTAL non-nil means assign new total window widths from pixel widths.
Source Code
;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun window--pixel-to-total (&optional frame horizontal)
"On FRAME assign new total window heights from pixel heights.
FRAME must be a live frame and defaults to the selected frame.
Optional argument HORIZONTAL non-nil means assign new total
window widths from pixel widths."
(setq frame (window-normalize-frame frame))
(let* ((char-size (frame-char-size frame horizontal))
(root (frame-root-window frame))
(root-size (window-size root horizontal t))
;; We have to care about the minibuffer window only if it
;; appears together with the root window on this frame.
(mini (let ((mini (minibuffer-window frame)))
(and (eq (window-frame mini) frame)
(not (eq mini root)) mini)))
(mini-size (and mini (window-size mini horizontal t))))
;; We round the line/column sizes of windows here to the nearest
;; integer. In some cases this can make windows appear _larger_
;; than the containing frame (line/column-wise) because the latter's
;; sizes are not (yet) rounded. We might eventually fix that.
(if (and mini (not horizontal))
(let (lines)
(set-window-new-total root (max (/ root-size char-size) 1))
(set-window-new-total mini (max (/ mini-size char-size) 1))
(setq lines (- (round (+ root-size mini-size) char-size)
(+ (window-new-total root) (window-new-total mini))))
(while (> lines 0)
(if (>= (% root-size (window-new-total root))
(% mini-size (window-new-total mini)))
(set-window-new-total root 1 t)
(set-window-new-total mini 1 t))
(setq lines (1- lines))))
(set-window-new-total root (round root-size char-size))
(when mini
;; This is taken in the horizontal case only.
(set-window-new-total mini (round mini-size char-size))))
(unless (window-buffer root)
(window--pixel-to-total-1 root horizontal char-size))
;; Apply the new sizes.
(window-resize-apply-total frame horizontal)))