gnome-desktop r5159 - trunk/libgnome-desktop



Author: ssp
Date: Tue Aug  5 05:58:22 2008
New Revision: 5159
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5159&view=rev

Log:
Tue Aug  5 01:55:50 2008  SÃren Sandmann  <sandmann redhat com>

	* gnome-rr-config.c (gnome_rr_config_new_current): Position
	displays that are turned off so that they don't overlap with any
	of the on displays.



Modified:
   trunk/libgnome-desktop/ChangeLog
   trunk/libgnome-desktop/gnome-rr-config.c

Modified: trunk/libgnome-desktop/gnome-rr-config.c
==============================================================================
--- trunk/libgnome-desktop/gnome-rr-config.c	(original)
+++ trunk/libgnome-desktop/gnome-rr-config.c	Tue Aug  5 05:58:22 2008
@@ -463,6 +463,7 @@
     int i;
     int clone_width = -1;
     int clone_height = -1;
+    int last_x;
 
     g_return_val_if_fail (screen != NULL, NULL);
 
@@ -536,7 +537,7 @@
 				clone_width = output->width;
 				clone_height = output->height;
 			} else if (clone_width == output->width &&
-					clone_height == output->height) {
+				   clone_height == output->height) {
 				config->clone = TRUE;
 			}
 		}
@@ -588,6 +589,34 @@
     
     config->outputs = (GnomeOutputInfo **)g_ptr_array_free (a, FALSE);
 
+    /* Walk the outputs computing the right-most edge of all
+     * lit-up displays
+     */
+    last_x = 0;
+    for (i = 0; config->outputs[i] != NULL; ++i)
+    {
+	GnomeOutputInfo *output = config->outputs[i];
+
+	if (output->on)
+	{
+	    last_x = MAX (last_x, output->x + output->width);
+	}
+    }
+
+    /* Now position all off displays to the right of the
+     * on displays
+     */
+    for (i = 0; config->outputs[i] != NULL; ++i)
+    {
+	GnomeOutputInfo *output = config->outputs[i];
+
+	if (output->connected && !output->on)
+	{
+	    output->x = last_x;
+	    last_x = output->x + output->width;
+	}
+    }
+    
     g_assert (gnome_rr_config_match (config, config));
     
     return config;



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