diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 46fc232489..1efea05778 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -1071,6 +1071,7 @@ _gdk_x11_screen_new (GdkDisplay *display, #endif if (scale_str) { + x11_screen->fixed_window_scale = TRUE; x11_screen->window_scale = atol (scale_str); if (x11_screen->window_scale == 0) x11_screen->window_scale = 1; diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h index f37b61a542..ce8598e11e 100644 --- a/gdk/x11/gdkscreen-x11.h +++ b/gdk/x11/gdkscreen-x11.h @@ -48,6 +48,7 @@ struct _GdkX11Screen gint primary_monitor; gint window_scale; + gboolean fixed_window_scale; /* Xft resources for the display, used for default values for * the Xft/ XSETTINGS diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 6f8527d412..49c1361ff8 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -156,6 +156,7 @@ gdk_window_impl_x11_init (GdkWindowImplX11 *impl) { impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref); + impl->window_scale = 1; } GdkToplevelX11 * @@ -1917,6 +1918,8 @@ _gdk_x11_window_set_window_scale (GdkWindow *window, if (window->window_type == GDK_WINDOW_OFFSCREEN) return; + g_print ("_gdk_x11_window_set_window_scale %p %d\n", window, scale); + impl = GDK_WINDOW_IMPL_X11 (window->impl); impl->window_scale = scale; diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index 475cbab8a4..2d1c2512d8 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -446,14 +446,17 @@ read_settings (GdkX11Screen *x11_screen, /* Since we support scaling we look at the specific Gdk/UnscaledDPI setting if it exists and use that instead of Xft/DPI if it is set */ - setting = g_hash_table_lookup (x11_screen->xsettings, "gdk-unscaled-dpi"); - if (setting) + if (x11_screen->xsettings && !x11_screen->fixed_window_scale) { - copy = g_new0 (GValue, 1); - g_value_init (copy, G_VALUE_TYPE (setting)); - g_value_copy (setting, copy); - g_hash_table_insert (x11_screen->xsettings, - "gtk-xft-dpi", copy); + setting = g_hash_table_lookup (x11_screen->xsettings, "gdk-unscaled-dpi"); + if (setting) + { + copy = g_new0 (GValue, 1); + g_value_init (copy, G_VALUE_TYPE (setting)); + g_value_copy (setting, copy); + g_hash_table_insert (x11_screen->xsettings, + "gtk-xft-dpi", copy); + } } if (do_notify) @@ -462,7 +465,8 @@ read_settings (GdkX11Screen *x11_screen, g_hash_table_unref (old_list); g_value_init (&value, G_TYPE_INT); - if (gdk_screen_get_setting (GDK_SCREEN (x11_screen), + if (!x11_screen->fixed_window_scale && + gdk_screen_get_setting (GDK_SCREEN (x11_screen), "gdk-window-scaling-factor", &value)) _gdk_x11_screen_set_window_scale (x11_screen, g_value_get_int (&value));