[gtk+/wip/window-scales2: 18/40] x11: Add Gdk/UnscaledDPI to override Xft/DPI



commit 4b9c08f48d6f5be43b0795d3eee462d60b5f9e1f
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Jun 28 13:23:45 2013 +0200

    x11: Add Gdk/UnscaledDPI to override Xft/DPI
    
    This lets use use a scaled Xft/DPI for old apps while not
    blowing up the size of scaled windows. Only apps supporting
    Gdk/WindowScaleFactor should supprt Gdk/UnscaledDPI.

 gdk/x11/gdksettings.c      |    3 ++-
 gdk/x11/xsettings-client.c |   13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c
index b86a17e..3b0e2e1 100644
--- a/gdk/x11/gdksettings.c
+++ b/gdk/x11/gdksettings.c
@@ -63,7 +63,8 @@ static const struct {
 
   /* These are here in order to be recognized, but are not sent to
      gtk as they are handled internally by gdk: */
-  {"Gdk/WindowScalingFactor", "gdk-window-scaling-factor"}
+  {"Gdk/WindowScalingFactor", "gdk-window-scaling-factor"},
+  {"Gdk/UnscaledDPI",         "gdk-unscaled-dpi"}
 };
 
 static const char *
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c
index 4cafb93..475cbab 100644
--- a/gdk/x11/xsettings-client.c
+++ b/gdk/x11/xsettings-client.c
@@ -410,6 +410,7 @@ read_settings (GdkX11Screen *x11_screen,
 
   GHashTable *old_list = x11_screen->xsettings;
   GValue value = G_VALUE_INIT;
+  GValue *setting, *copy;
 
   x11_screen->xsettings = NULL;
 
@@ -443,6 +444,18 @@ 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)
+    {
+      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)
     notify_changes (x11_screen, old_list);
   if (old_list)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]