[mutter/gbsneto/underscan: 298/299] monitor-manager: check for underscan setting validity upfront



commit a29e163825bb843d9892771fe51b5257f3bc407f
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Tue Jun 28 13:26:36 2016 -0700

    monitor-manager: check for underscan setting validity upfront
    
    Instead of doing a roundtrip to the X server before setting it, rely on
    the previous value fetched before the configuration was sent over DBus.
    This matches the argument check we already do elsewhere, and will allow
    us to more easily add an additional condition to determine if underscan
    is supported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767804
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/549

 src/backends/meta-monitor-manager.c   | 13 ++++++++++++-
 src/backends/x11/meta-output-xrandr.c |  4 +---
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index d2cbe2ec8..7b05d69db 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -1643,6 +1643,7 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
   MetaMonitor *monitor;
   MetaMonitorSpec *monitor_spec;
   MetaMonitorModeSpec *monitor_mode_spec;
+  MetaOutput *output;
   g_autoptr (GVariant) properties_variant = NULL;
   gboolean enable_underscanning = FALSE;
 
@@ -1667,7 +1668,17 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
       return NULL;
     }
 
-  g_variant_lookup (properties_variant, "underscanning", "b", &enable_underscanning);
+  output = meta_monitor_get_main_output (monitor);
+  if (g_variant_lookup (properties_variant, "underscanning", "b", &enable_underscanning))
+    {
+      if (enable_underscanning && !output->supports_underscanning)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Underscanning requested but unsupported");
+          return NULL;
+
+        }
+    }
 
   monitor_spec = meta_monitor_spec_clone (meta_monitor_get_spec (monitor));
 
diff --git a/src/backends/x11/meta-output-xrandr.c b/src/backends/x11/meta-output-xrandr.c
index f04515834..ed2ff28c9 100644
--- a/src/backends/x11/meta-output-xrandr.c
+++ b/src/backends/x11/meta-output-xrandr.c
@@ -169,9 +169,7 @@ meta_output_xrandr_apply_mode (MetaOutput *output)
     }
 
   output_set_presentation_xrandr (output, output->is_presentation);
-
-  if (output->supports_underscanning)
-    output_set_underscanning_xrandr (output, output->is_underscanning);
+  output_set_underscanning_xrandr (output, output->is_underscanning);
 }
 
 static int


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