[mutter/wip/wayland-display] MonitorManager: don't search for npreferred modes



commit f2359e216307dc53022eb0721a97f2b26eaf29be
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Thu Jul 25 15:33:37 2013 +0200

    MonitorManager: don't search for npreferred modes
    
    Under XRandR, the first mode is always the preferred one, which
    means we can also remove the value from the DBus protocol.
    
    Also, fix the dummy modes to be in order of preference, like
    GnomeRR expects.

 src/core/monitor.c |   35 ++++++++++++-----------------------
 src/xrandr.xml     |    3 +--
 2 files changed, 13 insertions(+), 25 deletions(-)
---
diff --git a/src/core/monitor.c b/src/core/monitor.c
index caca448..1a2a7f7 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -249,11 +249,11 @@ make_dummy_monitor_config (MetaMonitorManager *manager)
   manager->outputs[0].preferred_mode = &manager->modes[3];
   manager->outputs[0].n_modes = 5;
   manager->outputs[0].modes = g_new0 (MetaMonitorMode *, 5);
-  manager->outputs[0].modes[0] = &manager->modes[0];
-  manager->outputs[0].modes[1] = &manager->modes[1];
-  manager->outputs[0].modes[2] = &manager->modes[2];
-  manager->outputs[0].modes[3] = &manager->modes[3];
-  manager->outputs[0].modes[4] = &manager->modes[4];
+  manager->outputs[0].modes[0] = &manager->modes[3];
+  manager->outputs[0].modes[1] = &manager->modes[4];
+  manager->outputs[0].modes[2] = &manager->modes[0];
+  manager->outputs[0].modes[3] = &manager->modes[1];
+  manager->outputs[0].modes[4] = &manager->modes[2];
   manager->outputs[0].n_possible_crtcs = 3;
   manager->outputs[0].possible_crtcs = g_new0 (MetaCRTC *, 3);
   manager->outputs[0].possible_crtcs[0] = &manager->crtcs[0];
@@ -277,10 +277,10 @@ make_dummy_monitor_config (MetaMonitorManager *manager)
   manager->outputs[1].preferred_mode = &manager->modes[5];
   manager->outputs[1].n_modes = 4;
   manager->outputs[1].modes = g_new0 (MetaMonitorMode *, 4);
-  manager->outputs[1].modes[0] = &manager->modes[0];
-  manager->outputs[1].modes[1] = &manager->modes[1];
-  manager->outputs[1].modes[2] = &manager->modes[2];
-  manager->outputs[1].modes[3] = &manager->modes[5];
+  manager->outputs[1].modes[0] = &manager->modes[5];
+  manager->outputs[1].modes[1] = &manager->modes[0];
+  manager->outputs[1].modes[2] = &manager->modes[1];
+  manager->outputs[1].modes[3] = &manager->modes[2];
   manager->outputs[1].n_possible_crtcs = 3;
   manager->outputs[1].possible_crtcs = g_new0 (MetaCRTC *, 3);
   manager->outputs[1].possible_crtcs[0] = &manager->crtcs[0];
@@ -646,17 +646,7 @@ read_monitor_infos_from_xrandr (MetaMonitorManager *manager)
                       }
                   }
               }
-            for (k = 0; k < manager->n_modes; k++)
-              {
-                if (output->npreferred == manager->modes[k].mode_id)
-                  {
-                    meta_output->preferred_mode = &manager->modes[k];
-                    break;
-                  }
-              }
-
-            if (meta_output->preferred_mode == NULL)
-              meta_output->preferred_mode = meta_output->modes[0];
+            meta_output->preferred_mode = meta_output->modes[0];
 
             meta_output->n_possible_crtcs = output->ncrtc;
             meta_output->possible_crtcs = g_new0 (MetaCRTC *, meta_output->n_possible_crtcs);
@@ -1135,7 +1125,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
   unsigned int i, j;
 
   g_variant_builder_init (&crtc_builder, G_VARIANT_TYPE ("a(uxiiiiiuaua{sv})"));
-  g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiaussssiuauaua{sv})"));
+  g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiaussssiauaua{sv})"));
   g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuud)"));
 
   for (i = 0; i < manager->n_crtcs; i++)
@@ -1187,7 +1177,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
       g_variant_builder_add (&properties, "{sv}", "presentation",
                              g_variant_new_boolean (output->is_presentation));
 
-      g_variant_builder_add (&output_builder, "(uxiaussssiuauaua{sv})",
+      g_variant_builder_add (&output_builder, "(uxiaussssiauaua{sv})",
                              i, /* ID */
                              output->output_id,
                              (int)(output->crtc ? output->crtc - manager->crtcs : -1),
@@ -1197,7 +1187,6 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
                              output->product,
                              output->serial,
                              output->backlight,
-                             (unsigned)(output->preferred_mode - manager->modes),
                              &modes,
                              &clones,
                              &properties);
diff --git a/src/xrandr.xml b/src/xrandr.xml
index c0e4ac8..f7abefd 100644
--- a/src/xrandr.xml
+++ b/src/xrandr.xml
@@ -81,7 +81,6 @@
        * s product: the human readable name of the display model
        * s serial: the serial number of this particular hardward part
        * i backlight: the backlight value as a percentage (-1 if not supported)
-       * u preferred_mode: API id of the preferred mode
        * au modes: valid modes for this output
        * au clones: valid clones for this output, ie other outputs that
                     can be assigned the same CRTC as this one; if you
@@ -127,7 +126,7 @@
     <method name="GetResources">
       <arg name="serial" direction="out" type="u" />
       <arg name="crtcs" direction="out" type="a(uxiiiiiuaua{sv})" />
-      <arg name="outputs" direction="out" type="a(uxiaussssiuauaua{sv})" />
+      <arg name="outputs" direction="out" type="a(uxiaussssiauaua{sv})" />
       <arg name="modes" direction="out" type="a(uxuud)" />
       <arg name="max_screen_width" direction="out" type="i" />
       <arg name="max_screen_height" direction="out" type="i" />


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