Handle resolution changes in the GDK backend code

gdk_x11_display_set_window_scale() affects the interpretation of the
Xft/DPI XSETTING - it is substituted inside GDK with the value of
Gdk/UnscaledDPI xsetting. However, this change is not propagated to
GTK+ and from GTK+ back to gdk_screen_set_resolution() until the
main loop is run.

Fix this by handling the screen resolution directly in gdk/x11.
This requires duplication of code between GDK and GTK+ since we still
have to handle DPI in GTK+ in the case that GdkSettings:gtk-xft-dpi
is set by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=733076
This commit is contained in:
Owen W. Taylor
2014-07-11 16:42:38 -04:00
committed by Matthias Clasen
parent cef6f34fb7
commit fc6e2cc4b2
7 changed files with 105 additions and 18 deletions

View File

@ -477,7 +477,22 @@ update_xft_settings (GdkScreen *screen)
if (screen_wayland->xft_settings.dpi != xft_settings.dpi)
{
double dpi = xft_settings.dpi / 1024.;
const char *scale_env;
double scale;
screen_wayland->xft_settings.dpi = xft_settings.dpi;
scale_env = g_getenv ("GDK_DPI_SCALE");
if (scale_env)
{
scale = g_ascii_strtod (scale_env, NULL);
if (scale != 0 && dpi > 0)
dpi *= scale;
}
_gdk_screen_set_resolution (screen, dpi);
notify_setting (screen, "gtk-xft-dpi");
}
}