Re: screen resolution?

Alexander Larsson <> writes:

> Is there any way in gtk/gdk to get at the real resolution (in dots per inch) 
> of the screen?
> xdpyinfo says:
> screen #0:
>  dimensions:    1152x864 pixels (390x293 millimeters)
>  resolution:    75x75 dots per inch
> I don't know how accurate this is, but at least there are some data about this 
> in the x-server. 

gdk_screen_width() and gdk_screen_height() return the dimensions.

A patch with similar functions to return the screen resolution
would be gladly accepted.

[ Computed from the Xlib macros Width/HeightMMOfScreen(screen) -
  perhaps just gdk_screen_[width/height]_mm() functions ]

> Better use them than guessing at 72 dpi.

(GTK doesn't currently make any use of screen resolution. There
 is a confusing thing where dimensions for the rulers are specified
 in terms of 1/72 in. "pixels", but that has nothing to do with
 the size of pixels on the screen)


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