(window--atom-check frame))
;;; Window sizes.
-(defun window-total-size (&optional window horizontal)
+(defun window-total-size (&optional window horizontal round)
"Return the total height or width of WINDOW.
WINDOW must be a valid window and defaults to the selected one.
If HORIZONTAL is omitted or nil, return the total height of
WINDOW, in lines, like `window-total-height'. Otherwise return
-the total width, in columns, like `window-total-width'."
+the total width, in columns, like `window-total-width'.
+
+Optional argument ROUND is handled as for `window-total-height'
+and `window-total-width'."
(if horizontal
- (window-total-width window)
- (window-total-height window)))
+ (window-total-width window round)
+ (window-total-height window round)))
-(defun window-size (&optional window horizontal pixelwise)
+(defun window-size (&optional window horizontal pixelwise round)
"Return the height or width of WINDOW.
WINDOW must be a valid window and defaults to the selected one.
the total width, in columns, like `window-total-width'.
Optional argument PIXELWISE means return the pixel size of WINDOW
-like `window-pixel-height' and `window-pixel-width'."
+like `window-pixel-height' and `window-pixel-width'.
+
+Optional argument ROUND is ignored if PIXELWISE is non-nil and
+handled as for `window-total-height' and `window-total-width'
+otherwise."
(if horizontal
(if pixelwise
(window-pixel-width window)
- (window-total-width window))
+ (window-total-width window round))
(if pixelwise
(window-pixel-height window)
- (window-total-height window))))
+ (window-total-height window round))))
(defvar window-size-fixed nil
"Non-nil in a buffer means windows displaying the buffer are fixed-size.
(unless (eq sub window)
(setq delta
(min delta
- (- (window-size sub horizontal pixelwise)
+ (- (window-size sub horizontal pixelwise 'floor)
(window-min-size
sub horizontal ignore pixelwise)))))
(setq sub (window-right sub))))
Optional argument PIXELWISE non-nil means return number of pixels
by which WINDOW can be shrunk."
(setq window (window-normalize-window window))
- (let ((size (window-size window horizontal pixelwise))
+ (let ((size (window-size window horizontal pixelwise 'floor))
(minimum (window-min-size window horizontal ignore pixelwise)))
(cond
(nodown
(t
(setq delta
(+ delta
- (- (window-size sub horizontal pixelwise)
+ (- (window-size sub horizontal pixelwise 'floor)
(window-min-size
sub horizontal ignore pixelwise))))))
(setq sub (window-right sub))))
(window-bottom-divider-width)))
;; Round height.
(unless pixelwise
- (setq height (+ (/ height char-height)
- (if (zerop (% height char-height)) 0 1))))
+ (setq height (/ (+ height char-height -1) char-height)))
(unless (= height total-height)
(window-resize-no-error
window
(if pixelwise char-height 1))))
(window-right-divider-width))))
(unless pixelwise
- (setq width (+ (/ width char-width)
- (if (zerop (% width char-width)) 0 1))))
+ (setq width (/ (+ width char-width -1) char-width)))
(unless (= width body-width)
(window-resize-no-error
window