[gnome-settings-daemon/randr-osd] Don't allow mirror configurations with less than two outputs



commit 0ebc612e267dd05ec072523afb19231499c8078a
Author: Federico Mena Quintero <federico novell com>
Date:   Thu Mar 4 15:09:29 2010 -0600

    Don't allow mirror configurations with less than two outputs
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 plugins/xrandr/gsd-xrandr-manager.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 8bc30fc..7395fc6 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -619,12 +619,15 @@ make_clone_stock_config (GnomeRRScreen *screen)
         GnomeRRConfig *rr_config;
         int width, height;
         int i;
+        int num_outputs_on;
 
         if (!get_clone_size (screen, &width, &height))
                 return NULL;
 
         rr_config = gnome_rr_config_new_current (screen);
 
+        num_outputs_on = 0;
+
         for (i = 0; rr_config->outputs[i] != NULL; ++i) {
                 GnomeOutputInfo *info = rr_config->outputs[i];
 
@@ -651,6 +654,7 @@ make_clone_stock_config (GnomeRRScreen *screen)
                         }
 
                         if (best_rate > 0) {
+                                num_outputs_on++;
                                 info->on = TRUE;
                                 info->width = width;
                                 info->height = height;
@@ -662,6 +666,11 @@ make_clone_stock_config (GnomeRRScreen *screen)
                 }
         }
 
+        if (num_outputs_on < 2) {
+                gnome_rr_config_free (rr_config);
+                return NULL;
+        }
+
         print_configuration (rr_config, "clone setup");
 
         return stock_config_new (STOCK_CONFIG_CLONE_LAPTOP, rr_config); /* FMQ: figure out if this is a laptop or two monitors clone */



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