[clutter/clutter-1.18] settings: Add CLUTTER_DPI_SCALE



commit 696a536b26ea50ab63217e0f3829e7edcc553a4b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jan 22 01:24:16 2014 +0000

    settings: Add CLUTTER_DPI_SCALE
    
    Like we do for the windowing surfaces, we should have a run time knob
    (in the form of an environment variable) to allow changing the scaling
    factor of the font resolution.

 clutter/clutter-settings.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-settings.c b/clutter/clutter-settings.c
index 2c06f8a..56d785d 100644
--- a/clutter/clutter-settings.c
+++ b/clutter/clutter-settings.c
@@ -205,6 +205,8 @@ settings_update_font_name (ClutterSettings *self)
 static void
 settings_update_resolution (ClutterSettings *self)
 {
+  const char *scale_env = NULL;
+
   if (self->unscaled_font_dpi > 0)
     self->resolution = (gdouble) self->unscaled_font_dpi / 1024.0;
   else if (self->font_dpi > 0)
@@ -212,6 +214,14 @@ settings_update_resolution (ClutterSettings *self)
   else
     self->resolution = 96.0;
 
+  scale_env = g_getenv ("GDK_DPI_SCALE");
+  if (scale_env != NULL)
+    {
+      double scale = g_ascii_strtod (scale_env, NULL);
+      if (scale != 0 && self->resolution > 0)
+        self->resolution *= scale;
+    }
+
   CLUTTER_NOTE (BACKEND, "New resolution: %.2f (%s)",
                 self->resolution,
                 self->unscaled_font_dpi > 0 ? "unscaled" : "scaled");
@@ -706,6 +716,9 @@ clutter_settings_init (ClutterSettings *self)
 
   self->resolution = -1.0;
 
+  self->font_dpi = -1;
+  self->unscaled_font_dpi = -1;
+
   self->double_click_time = 250;
   self->double_click_distance = 5;
 


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