[mutter] monitor-manager: check framebuffer limits for all configs



commit d7854794cf092995950e9c3012ecf00564fb9b8c
Author: Jonathon Jongsma <jjongsma redhat com>
Date:   Wed Nov 19 10:56:27 2014 -0600

    monitor-manager: check framebuffer limits for all configs
    
    Refactor make_default_config() to always sanity-check the configuration to
    ensure that it fits within the framebuffer. Previously, this was only done
    for the default linear configuration.

 src/backends/meta-monitor-config.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c
index 81f0a5e..c249e5d 100644
--- a/src/backends/meta-monitor-config.c
+++ b/src/backends/meta-monitor-config.c
@@ -1179,10 +1179,6 @@ make_linear_config (MetaMonitorConfig *self,
           config->outputs[i].rect.x = x;
           x += config->outputs[i].rect.width;
         }
-
-      /* Disable outputs that would go beyond framebuffer limits */
-      if (config->outputs[i].rect.x + config->outputs[i].rect.width > max_width)
-        config->outputs[i].enabled = FALSE;
     }
 }
 
@@ -1263,6 +1259,7 @@ make_default_config (MetaMonitorConfig *self,
                      gboolean           use_stored_config)
 {
   MetaConfiguration *ret = NULL;
+  unsigned i;
 
   ret = config_new ();
   make_config_key (ret, outputs, n_outputs, -1);
@@ -1272,21 +1269,29 @@ make_default_config (MetaMonitorConfig *self,
      nothing else to do */
   if (n_outputs == 1)
     {
-
       init_config_from_preferred_mode (&ret->outputs[0], &outputs[0]);
       ret->outputs[0].is_primary = TRUE;
-      return ret;
+      goto check_limits;
     }
 
   if (make_suggested_config (self, outputs, n_outputs, max_width, max_height, ret))
-      return ret;
+      goto check_limits;
 
   if (use_stored_config &&
       extend_stored_config (self, outputs, n_outputs, max_width, max_height, ret))
-      return ret;
+      goto check_limits;
 
   make_linear_config (self, outputs, n_outputs, max_width, max_height, ret);
 
+check_limits:
+  /* Disable outputs that would go beyond framebuffer limits */
+  for (i = 0; i < n_outputs; i++)
+    {
+        if ((ret->outputs[i].rect.x + ret->outputs[i].rect.width > max_width)
+            || (ret->outputs[i].rect.y + ret->outputs[i].rect.height > max_height))
+          ret->outputs[i].enabled = FALSE;
+    }
+
   return ret;
 }
 


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