[gtk+/wip/window-scales] x11: Don't follow dpi and scale from xsettings when GDK_SCALE set
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/window-scales] x11: Don't follow dpi and scale from xsettings when GDK_SCALE set
- Date: Mon, 1 Jul 2013 18:56:02 +0000 (UTC)
commit 3563bdcce71be22eb18c3253da3507904192da0c
Author: Alexander Larsson <alexl redhat com>
Date: Mon Jul 1 20:50:44 2013 +0200
x11: Don't follow dpi and scale from xsettings when GDK_SCALE set
If things are hardcoded in the environment, that wins.
gdk/x11/gdkscreen-x11.c | 1 +
gdk/x11/gdkscreen-x11.h | 1 +
gdk/x11/gdkwindow-x11.c | 3 +++
gdk/x11/xsettings-client.c | 20 ++++++++++++--------
4 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 46fc232..1efea05 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 f37b61a..ce8598e 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 6f8527d..49c1361 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 475cbab..2d1c251 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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]