I've got some BGL drawing code which draws some outlines over nodes in screen-space coordinates. It accounts for the DPI settings in the User Preferences and scales up the size and position of drawn objects accordingly.
The problem is, if a user is using a Retina display, the DPI value in the preferences doesn't actually change, even though it virtually doubles, thus the screen coordinates are all wrong:
The red outlines are supposed to sit exactly on top of the nodes. This works fine on a non-retina display.
So how can I check whether blender is running on a Retina display from python?
The code is all here: http://hastebin.com/gipifamoco.py - at line 607
is where I take into account the DPI and
"Virtual Pixel Mode" option in the user prefs (which can be set to 'Double' to simulate using a Retina display, but stays at 'Native' when using an actual Retina display)
So theoretically I'd like to be able to change:
retinafac = (2 if bpy.context.user_preferences.system.virtual_pixel_mode == 'DOUBLE' else 1)
to:
retinafac = (2 if (bpy.context.user_preferences.system.virtual_pixel_mode == 'DOUBLE' or <using retina display>) else 1)
where <using retina display>
is the check.
bpy.context.user_preferences.system.pixel_size
developer.blender.org/… $\endgroup$