[mutter/benzea/ignore-monitor-connector: 20/24] monitor: Make the connector the last sort key for monitors



commit 691e1fec3c0ab7c18f144b8fdf9833d3ee3c2acd
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Dec 20 13:47:31 2019 +0100

    monitor: Make the connector the last sort key for monitors
    
    We want to ignore the connector in certain situations. Prepare this by
    changing the sort order so that two monitors will be paired up in the
    list if only the connector is different.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/932

 src/backends/meta-monitor.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 2b0aa5ac6..5d163e1a8 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -140,19 +140,23 @@ meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a,
 {
   int ret;
 
-  ret = strcmp (monitor_spec_a->connector, monitor_spec_b->connector);
+  ret = strcmp (monitor_spec_a->vendor, monitor_spec_b->vendor);
   if (ret != 0)
     return ret;
 
-  ret = strcmp (monitor_spec_a->vendor, monitor_spec_b->vendor);
+  ret = strcmp (monitor_spec_a->product, monitor_spec_b->product);
   if (ret != 0)
     return ret;
 
-  ret = strcmp (monitor_spec_a->product, monitor_spec_b->product);
+  ret = strcmp (monitor_spec_a->serial, monitor_spec_b->serial);
+  if (ret != 0)
+    return ret;
+
+  ret = strcmp (monitor_spec_a->connector, monitor_spec_b->connector);
   if (ret != 0)
     return ret;
 
-  return strcmp (monitor_spec_a->serial, monitor_spec_b->serial);
+  return 0;
 }
 
 void


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