gnome-control-center r8784 - trunk/capplets/display



Author: ssp
Date: Tue Jul 15 22:51:02 2008
New Revision: 8784
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8784&view=rev

Log:
Tue Jul 15 18:48:43 2008  S%GÃÂÂ% ren Sandmann  <sandmann redhat com>

	* xrandr-capplet.c: Don't allow dragging when there is only one
	connected monitor.



Modified:
   trunk/capplets/display/ChangeLog
   trunk/capplets/display/xrandr-capplet.c

Modified: trunk/capplets/display/xrandr-capplet.c
==============================================================================
--- trunk/capplets/display/xrandr-capplet.c	(original)
+++ trunk/capplets/display/xrandr-capplet.c	Tue Jul 15 22:51:02 2008
@@ -790,14 +790,25 @@
     return g_list_reverse (result);
 }
 
+static int
+get_n_connected (App *app)
+{
+    GList *connected_outputs = list_connected_outputs (app, NULL, NULL);
+    int n = g_list_length (connected_outputs);
+
+    g_list_free (connected_outputs);
+
+    return n;
+}
+
 static double
 compute_scale (App *app)
 {
-    GList *connected_outputs;
     int available_w, available_h;
     int total_w, total_h;
     int n_monitors;
     GdkRectangle viewport;
+    GList *connected_outputs;
     
     foo_scroll_area_get_viewport (FOO_SCROLL_AREA (app->area), &viewport);
 
@@ -805,6 +816,8 @@
     
     n_monitors = g_list_length (connected_outputs);
 
+    g_list_free (connected_outputs);
+
     available_w = viewport.width - 2 * MARGIN - (n_monitors - 1) * SPACE;
     available_h = viewport.height - 2 * MARGIN - (n_monitors - 1) * SPACE;
 
@@ -1128,7 +1141,7 @@
 
     d = sv1 - sv2;
 
-    /* This snapping algorithm is good for rock'n'roll, but
+    /* This snapping algorithm is good enough for rock'n'roll, but
      * this is probably a better:
      *
      *    First do a horizontal/vertical snap, then
@@ -1169,17 +1182,20 @@
 	app->current_output = output;
 
 	rebuild_gui (app);
-	
-	foo_scroll_area_begin_grab (area, on_output_event, data);
 
-	info = g_new0 (GrabInfo, 1);
-	info->grab_x = event->x;
-	info->grab_y = event->y;
-	info->output_x = output->x;
-	info->output_y = output->y;
+	if (!app->current_configuration->clone && get_n_connected (app) > 1)
+	{
+	    foo_scroll_area_begin_grab (area, on_output_event, data);
+	    
+	    info = g_new0 (GrabInfo, 1);
+	    info->grab_x = event->x;
+	    info->grab_y = event->y;
+	    info->output_x = output->x;
+	    info->output_y = output->y;
+	    
+	    output->user_data = info;
+	}
 	
-	output->user_data = info;
-
 	foo_scroll_area_invalidate (area);
     }
     else



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