Commit 3563bdcc authored by Alexander Larsson's avatar Alexander Larsson
Browse files

x11: Don't follow dpi and scale from xsettings when GDK_SCALE set

If things are hardcoded in the environment, that wins.
parent 8e6eb0da
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment