-
Windows Use
GetDpiForMonitor
API withMDT_EFFECTIVE_DPI
as DPI type. Windows 8.1 and up; for compatibility, load the function dynamically withGetProcAddress
. If DPI >= 192, scale can be taken as 2.0, otherwise 1.0. https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-getdpiformonitor -
Linux: Check the Xft.dpi resource. If DPI >= 192, scale can be taken as 2.0, otherwise 1.0. glfw/glfw#1019
-
Mac: Use the result of Cocoa API
NSScreen::backingScaleFactor
. https://developer.apple.com/documentation/appkit/nsscreen/1388385-backingscalefactor?language=objc
Created
January 10, 2020 07:49
-
-
Save jpcima/752b3eaeb6ad7bdca75128052bd9bb81 to your computer and use it in GitHub Desktop.
How to get portable window scale factor (Retina)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment