[metacity/wip/window-scaling-factor: 2/3] libmetacity: add get_window_scaling_factor



commit fabd75a3655fdfee8f4fc8436c105f85629a607f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Mar 23 20:43:28 2016 +0200

    libmetacity: add get_window_scaling_factor
    
    Based on mutter commit:
    https://git.gnome.org/browse/mutter/commit/?id=57c1078ee742d9f01e80e7fe05c88adfec4b4ac3

 libmetacity/meta-theme-impl-private.h |    3 +++
 libmetacity/meta-theme-impl.c         |   16 ++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libmetacity/meta-theme-impl-private.h b/libmetacity/meta-theme-impl-private.h
index e31a948..1ec87b4 100644
--- a/libmetacity/meta-theme-impl-private.h
+++ b/libmetacity/meta-theme-impl-private.h
@@ -98,6 +98,9 @@ G_GNUC_INTERNAL
 void               scale_border                  (GtkBorder               *border,
                                                   double                   factor);
 
+G_GNUC_INTERNAL
+int                get_window_scaling_factor     (void);
+
 G_END_DECLS
 
 #endif
diff --git a/libmetacity/meta-theme-impl.c b/libmetacity/meta-theme-impl.c
index b16d5ea..1002adf 100644
--- a/libmetacity/meta-theme-impl.c
+++ b/libmetacity/meta-theme-impl.c
@@ -308,3 +308,19 @@ scale_border (GtkBorder *border,
   border->top *= factor;
   border->bottom *= factor;
 }
+
+int
+get_window_scaling_factor (void)
+{
+  GdkScreen *screen;
+  GValue value = G_VALUE_INIT;
+
+  screen = gdk_screen_get_default ();
+
+  g_value_init (&value, G_TYPE_INT);
+
+  if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value))
+    return g_value_get_int (&value);
+  else
+    return 1;
+}


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