gnome-desktop r5311 - trunk/libgnome-desktop



Author: federico
Date: Thu Dec  4 00:28:54 2008
New Revision: 5311
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5311&view=rev

Log:
Error reporting for crtc_assignment_apply()

Signed-off-by: Federico Mena Quintero <federico novell com>

Modified:
   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	Thu Dec  4 00:28:54 2008
@@ -1337,6 +1337,11 @@
     g_free (assign);
 }
 
+typedef struct {
+    gboolean has_error;
+    GError **error;
+} ConfigureCrtcState;
+
 static void
 configure_crtc (gpointer key,
 		gpointer value,
@@ -1344,13 +1349,19 @@
 {
     GnomeRRCrtc *crtc = key;
     CrtcInfo *info = value;
+    ConfigureCrtcState *state = data;
+
+    if (state->has_error)
+	return;
 
-    gnome_rr_crtc_set_config (crtc,
-			info->x, info->y,
-			info->mode,
-			info->rotation,
-			(GnomeRROutput **)info->outputs->pdata,
-			info->outputs->len);
+    if (!gnome_rr_crtc_set_config (crtc,
+				   info->x, info->y,
+				   info->mode,
+				   info->rotation,
+				   (GnomeRROutput **)info->outputs->pdata,
+				   info->outputs->len,
+				   state->error))
+	state->has_error = TRUE;
 }
 
 static gboolean
@@ -1526,7 +1537,7 @@
 }
 
 static gboolean
-crtc_assignment_apply (CrtcAssignment *assign)
+crtc_assignment_apply (CrtcAssignment *assign, GError **error)
 {
     GnomeRRCrtc **all_crtcs = gnome_rr_screen_list_crtcs (assign->screen);
     int width, height;
@@ -1548,6 +1559,8 @@
     width = MIN (max_width, width);
     height = MAX (min_height, height);
     height = MIN (max_height, height);
+
+    /* FMQ: do we need to check the sizes instead of clamping them? */
     
     /* Turn off all crtcs that are currently displaying outside the new screen,
      * or are not used in the new setup
@@ -1575,7 +1588,7 @@
 	    
 	    if (x + w > width || y + h > height || !g_hash_table_lookup (assign->info, crtc))
 	    {
-		if (!gnome_rr_crtc_set_config (crtc, 0, 0, NULL, GNOME_RR_ROTATION_0, NULL, 0))
+		if (!gnome_rr_crtc_set_config (crtc, 0, 0, NULL, GNOME_RR_ROTATION_0, NULL, 0, error))
 		{
 		    success = FALSE;
 		    break;
@@ -1596,9 +1609,16 @@
 
     if (success)
     {
+	ConfigureCrtcState state;
+
 	gnome_rr_screen_set_size (assign->screen, width, height, width_mm, height_mm);
+
+	state.has_error = FALSE;
+	state.error = error;
 	
-	g_hash_table_foreach (assign->info, configure_crtc, NULL);
+	g_hash_table_foreach (assign->info, configure_crtc, &state);
+
+	success = !state.has_error;
     }
 
     return success;



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