[mutter] backends: Add flags to MetaMonitorMode



commit 1141929bc5a90c6cbdf92881d6296812c283d788
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Apr 21 17:49:55 2015 +0200

    backends: Add flags to MetaMonitorMode
    
    And export them in the DBus API since they're useful for
    gnome-control-center.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763832

 src/backends/meta-monitor-manager-private.h    |    1 +
 src/backends/meta-monitor-manager.c            |    7 ++++---
 src/backends/native/meta-monitor-manager-kms.c |    1 +
 src/backends/x11/meta-monitor-manager-xrandr.c |    1 +
 src/org.gnome.Mutter.DisplayConfig.xml         |    3 ++-
 5 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 7cda017..58d232a 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -190,6 +190,7 @@ struct _MetaMonitorMode
   int width;
   int height;
   float refresh_rate;
+  guint32 flags;
 
   gpointer driver_private;
   GDestroyNotify driver_notify;
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 93588e3..e00d3ce 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -590,7 +590,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
 
   g_variant_builder_init (&crtc_builder, G_VARIANT_TYPE ("a(uxiiiiiuaua{sv})"));
   g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiausauaua{sv})"));
-  g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuud)"));
+  g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuudu)"));
 
   for (i = 0; i < manager->n_crtcs; i++)
     {
@@ -714,12 +714,13 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
     {
       MetaMonitorMode *mode = &manager->modes[i];
 
-      g_variant_builder_add (&mode_builder, "(uxuud)",
+      g_variant_builder_add (&mode_builder, "(uxuudu)",
                              i, /* ID */
                              (gint64)mode->mode_id,
                              (guint32)mode->width,
                              (guint32)mode->height,
-                             (double)mode->refresh_rate);
+                             (double)mode->refresh_rate,
+                             (guint32)mode->flags);
     }
 
   meta_dbus_display_config_complete_get_resources (skeleton,
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index e1a6f5f..a28ef79 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -632,6 +632,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
       meta_mode->name = g_strndup (mode->name, DRM_DISPLAY_MODE_LEN);
       meta_mode->width = mode->hdisplay;
       meta_mode->height = mode->vdisplay;
+      meta_mode->flags = mode->flags;
 
       /* Calculate refresh rate in milliHz first for extra precision. */
       meta_mode->refresh_rate = (mode->clock * 1000000LL) / mode->htotal;
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 47fe891..b0a77da 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -788,6 +788,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
       mode->height = xmode->height;
       mode->refresh_rate = (xmode->dotClock /
                            ((float)xmode->hTotal * xmode->vTotal));
+      mode->flags = xmode->modeFlags;
       mode->name = get_xmode_name (xmode);
     }
 
diff --git a/src/org.gnome.Mutter.DisplayConfig.xml b/src/org.gnome.Mutter.DisplayConfig.xml
index 06449c3..16ef01e 100644
--- a/src/org.gnome.Mutter.DisplayConfig.xml
+++ b/src/org.gnome.Mutter.DisplayConfig.xml
@@ -115,6 +115,7 @@
        * x winsys_id: the low-level ID of this mode
        * u width, height: the resolution
        * d frequency: refresh rate
+        * u flags: mode flags as defined in xf86drmMode.h and randr.h
 
         Output and modes are read-only objects (except for output properties),
        they can change only in accordance to HW changes (such as hotplugging
@@ -133,7 +134,7 @@
       <arg name="serial" direction="out" type="u" />
       <arg name="crtcs" direction="out" type="a(uxiiiiiuaua{sv})" />
       <arg name="outputs" direction="out" type="a(uxiausauaua{sv})" />
-      <arg name="modes" direction="out" type="a(uxuud)" />
+      <arg name="modes" direction="out" type="a(uxuudu)" />
       <arg name="max_screen_width" direction="out" type="i" />
       <arg name="max_screen_height" direction="out" type="i" />
     </method>


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