GDK W32: add environment variable to override system font scaling

Support environment variable GDK_WIN32_FONT_RESOLUTION that can be set to
a desired dpi (72, 96, 130, etc) to override system settings. Useful for
debugging, since changing system font scaling requires the user to log off
and log on again.

https://bugzilla.gnome.org/show_bug.cgi?id=734038
This commit is contained in:
Руслан Ижбулатов 2014-07-31 14:03:00 +00:00
parent f38498ed84
commit a235dd6a6c

View File

@ -39,6 +39,7 @@ gdk_win32_screen_init (GdkWin32Screen *display)
GdkScreen *screen = GDK_SCREEN (display);
HDC screen_dc;
int logpixelsx = -1;
const gchar *font_resolution;
screen_dc = GetDC (NULL);
@ -48,6 +49,14 @@ gdk_win32_screen_init (GdkWin32Screen *display)
ReleaseDC (NULL, screen_dc);
}
font_resolution = g_getenv ("GDK_WIN32_FONT_RESOLUTION");
if (font_resolution)
{
int env_logpixelsx = atol (font_resolution);
if (env_logpixelsx > 0)
logpixelsx = env_logpixelsx;
}
if (logpixelsx > 0)
_gdk_screen_set_resolution (screen, logpixelsx);
}