[mutter] monitor-manager: Add supported scales to D-Bus API



commit 9003a42df3ab7af2fac439c916080d964a18e826
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Jan 26 17:15:52 2017 +0800

    monitor-manager: Add supported scales to D-Bus API
    
    Let the configuring client know what scales are supported by the
    display server.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/backends/meta-monitor-manager.c    |   23 +++++++++++++++++++++++
 src/org.gnome.Mutter.DisplayConfig.xml |    6 ++++++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 946233c..8965953 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -289,6 +289,17 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
 }
 
 static void
+meta_monitor_manager_get_supported_scales (MetaMonitorManager *manager,
+                                           float             **scales,
+                                           int                *n_scales)
+{
+  MetaMonitorManagerClass *manager_class =
+    META_MONITOR_MANAGER_GET_CLASS (manager);
+
+  manager_class->get_supported_scales (manager, scales, n_scales);
+}
+
+static void
 meta_monitor_manager_ensure_initial_config (MetaMonitorManager *manager)
 {
   META_MONITOR_MANAGER_GET_CLASS (manager)->ensure_initial_config (manager);
@@ -1194,8 +1205,12 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
   MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
   GVariantBuilder monitors_builder;
   GVariantBuilder logical_monitors_builder;
+  GVariantBuilder supported_scales_builder;
   GVariantBuilder max_screen_size_builder;
   GList *l;
+  float *supported_scales;
+  int n_supported_scales;
+  int i;
 
   g_variant_builder_init (&monitors_builder,
                           G_VARIANT_TYPE (MONITORS_FORMAT));
@@ -1294,6 +1309,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
                              NULL);
     }
 
+  g_variant_builder_init (&supported_scales_builder, G_VARIANT_TYPE ("ad"));
+  meta_monitor_manager_get_supported_scales (manager,
+                                             &supported_scales,
+                                             &n_supported_scales);
+  for (i = 0; i < n_supported_scales; i++)
+    g_variant_builder_add (&supported_scales_builder, "d", supported_scales[i]);
+
   g_variant_builder_init (&max_screen_size_builder,
                           G_VARIANT_TYPE ("(ii)"));
   g_variant_builder_add (&max_screen_size_builder, "i",
@@ -1307,6 +1329,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
     manager->serial,
     g_variant_builder_end (&monitors_builder),
     g_variant_builder_end (&logical_monitors_builder),
+    g_variant_builder_end (&supported_scales_builder),
     g_variant_builder_end (&max_screen_size_builder));
 
   return TRUE;
diff --git a/src/org.gnome.Mutter.DisplayConfig.xml b/src/org.gnome.Mutter.DisplayConfig.xml
index 22cb017..33e9690 100644
--- a/src/org.gnome.Mutter.DisplayConfig.xml
+++ b/src/org.gnome.Mutter.DisplayConfig.xml
@@ -296,6 +296,7 @@
        @serial: configuration serial
        @monitors: available monitors
        @logical_monitors: current logical monitor configuration
+       @supported_scales: scaling factors supported by the display server
        @max_screen_size: the maximum screen size
 
        @monitors represent connected physical monitors
@@ -340,11 +341,16 @@
 
        @max_screen_size represents the maximum size the screen may have, or 0x0 if no
        such limit is known.
+
+
+       @supported_scales is an ordered list of floating point numbers representing
+       scale factors of logical monitors supported by the display server.
     -->
     <method name="GetCurrentState">
       <arg name="serial" direction="out" type="u" />
       <arg name="monitors" direction="out" type="a((ssss)a(iiddu)a{sv})" />
       <arg name="logical_monitors" direction="out" type="a(iiiia(ssss)dba{sv})" />
+      <arg name="supported_scales" direction="out" type="ad" />
       <arg name="max_screen_size" direction="out" type="(ii)" />
     </method>
   </interface>


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