I need to know active screen DPI on Linux and Mac OS. I think on linux xlib might be useful, but I can't find a way how to get currect DPI. I want this information to get real screen size in inches.
Thanks in advance!
In X on Linux, call XOpenDisplay()
to get the Display
, then use DisplayWidthMM()
and DisplayHeightMM()
together with DisplayWidth()
and DisplayHeight()
to compute the DPI.
On the Mac, there's almost certainly a more native API to use than X. Mac OS X does not run X Window by default, it has a native windowing environment.