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!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In X on Linux, call
XOpenDisplay()to get theDisplay, then useDisplayWidthMM()andDisplayHeightMM()together withDisplayWidth()andDisplayHeight()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.