Function: window-size

window-size is a byte-compiled function defined in window.el.gz.

Signature

(window-size &optional WINDOW HORIZONTAL PIXELWISE ROUND)

Documentation

Return the 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.

Optional argument PIXELWISE means return the pixel size of WINDOW 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.

Probably introduced at or before Emacs version 24.4.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(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.

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'.

Optional argument PIXELWISE means return the pixel size of WINDOW
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 round))
    (if pixelwise
	(window-pixel-height window)
      (window-total-height window round))))