[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculate window size in pixels

From: Mathias Dahl
Subject: Re: Calculate window size in pixels
Date: 06 May 2005 17:36:43 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Stefan Monnier <address@hidden> writes:

> > Is it possible to calculate an Emacs window's size in pixels?
> > `window-height' and `window-width' returns lines and columns.
> There's frame-pixel-height in Emacs-CVS.
> There's also window-pixel-edges if you care about windows rather
> than frames.

Which means I can use this:

(defun window-height-pixels ()
  (let ((line-pixel-height-ratio (/ (+ (frame-pixel-height) 0.0) 
        (column-pixel-width-ratio (/ (+ (frame-pixel-width) 0.0) 
    (ftruncate (* (window-height) line-pixel-height-ratio))))

(defun window-width-pixels ()
  (let ((column-pixel-width-ratio (/ (+ (frame-pixel-width) 0.0) 
    (ftruncate (* (window-width) column-pixel-width-ratio))))

I see that the frame-pixel-functions is including window
decorations and stuff, but I guess it can work for my
purposes anyway.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]