[maemo-commits] [maemo-commits] r13577 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Sep 4 15:54:09 EEST 2007
Author: jobi
Date: 2007-09-04 15:54:07 +0300 (Tue, 04 Sep 2007)
New Revision: 13577

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-picture.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
   projects/haf/trunk/hildon-desktop/src/hd-home-window.c
Log:

2007-09-04 Johan Bilien  <johan.bilien at nokia.com>

	* libhildondesktop/hildon-desktop-picture.c,
	libhildondesktop/hildon-desktop-toggle-button.c,
	libhildondesktop/hildon-home-area.c,
	libhildondesktop/hildon-desktop-panel-window-composite.c,
	src/hd-home-window.c:
	- added some safeguard for X errors.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-04 12:24:55 UTC (rev 13576)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-04 12:54:07 UTC (rev 13577)
@@ -1,3 +1,12 @@
+2007-09-04 Johan Bilien  <johan.bilien at nokia.com>
+
+	* libhildondesktop/hildon-desktop-picture.c,
+	libhildondesktop/hildon-desktop-toggle-button.c,
+	libhildondesktop/hildon-home-area.c,
+	libhildondesktop/hildon-desktop-panel-window-composite.c,
+	src/hd-home-window.c:
+	- added some safeguard for X errors.
+
 2007-09-04  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* src/hd-switcher-menu.c (hd_switcher_menu_clear_item_activated), 

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c	2007-09-04 12:24:55 UTC (rev 13576)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c	2007-09-04 12:54:07 UTC (rev 13577)
@@ -418,6 +418,7 @@
                                         &y_offset);
 
     picture = hildon_desktop_picture_from_drawable (drawable);
+    g_return_val_if_fail (picture, FALSE);
 
     g_object_set_data (G_OBJECT (drawable),
                        "picture", GINT_TO_POINTER (picture));
@@ -443,9 +444,10 @@
                                     priv->background_picture,
                                     &priv->transform);
 
-        XRenderSetPictureTransform (GDK_DISPLAY (),
-                                    priv->background_mask,
-                                    &priv->transform);
+        if (priv->background_mask != None)
+          XRenderSetPictureTransform (GDK_DISPLAY (),
+                                      priv->background_mask,
+                                      &priv->transform);
       }
 
       XRenderComposite (GDK_DISPLAY (),

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-picture.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-picture.c	2007-09-04 12:24:55 UTC (rev 13576)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-picture.c	2007-09-04 12:54:07 UTC (rev 13577)
@@ -279,7 +279,7 @@
     }
 
   if (gdk_error_trap_pop ())
-    g_warning ("X Error while loading picture from file");
+    g_critical ("X Error while loading picture from file");
 }
 
 Picture
@@ -294,19 +294,29 @@
 
   visual = gdk_drawable_get_visual (drawable);
 
+  gdk_error_trap_push ();
   format = XRenderFindVisualFormat (GDK_DISPLAY (),
                                     GDK_VISUAL_XVISUAL (visual));
 
-  if (format == NULL)
+  if (gdk_error_trap_pop () || format == NULL)
+  {
+    g_critical ("Could not find requested format for X Picture");
     return None;
+  }
 
   pa.subwindow_mode = IncludeInferiors;
   pa.repeat = False;
+  gdk_error_trap_push ();
   picture = XRenderCreatePicture (GDK_DISPLAY (),
                                   GDK_DRAWABLE_XID (drawable),
                                   format,
                                   CPSubwindowMode | CPRepeat,
                                   &pa);
+  if (gdk_error_trap_pop ())
+  {
+    g_critical ("X Error when creating picture from drawable.");
+    return None;
+  }
 
   return picture;
 }

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c	2007-09-04 12:24:55 UTC (rev 13576)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c	2007-09-04 12:54:07 UTC (rev 13577)
@@ -109,6 +109,8 @@
         {
           picture_is_ours = TRUE;
           picture = hildon_desktop_picture_from_drawable (drawable);
+
+          g_return_val_if_fail (picture != None, FALSE);
         }
 
       if (priv->pressed_picture != None  && button->depressed)

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-09-04 12:24:55 UTC (rev 13576)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-09-04 12:54:07 UTC (rev 13577)
@@ -899,6 +899,8 @@
 
   alloc = &(child_data->widget->allocation);
 
+  g_return_if_fail (priv->picture != None);
+
   XRenderComposite (GDK_DISPLAY (),
                     (child_data->state == 0)?PictOpOver:PictOpSrc,
                     child_data->picture,

Modified: projects/haf/trunk/hildon-desktop/src/hd-home-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-home-window.c	2007-09-04 12:24:55 UTC (rev 13576)
+++ projects/haf/trunk/hildon-desktop/src/hd-home-window.c	2007-09-04 12:54:07 UTC (rev 13577)
@@ -745,7 +745,8 @@
                                    &format, &n_res,
                                    &extra, (unsigned char **) &res.pointer);
 
-      gdk_error_trap_pop ();
+      if (gdk_error_trap_pop ())
+        return GDK_FILTER_CONTINUE;
 
       if ((status != Success) || (real_type != XA_WINDOW) ||
           (format != 32) || (n_res != 1) || (res.win == NULL) ||
@@ -801,6 +802,7 @@
                                               &x_offset, &y_offset);
 
           picture = hildon_desktop_picture_from_drawable (drawable);
+          g_return_val_if_fail (picture != None, FALSE);
 
           XRenderComposite (GDK_DISPLAY (),
                             PictOpSrc,
@@ -811,7 +813,6 @@
                             0, 0,
                             - x_offset, - y_offset,
                             widget->allocation.width, widget->allocation.height);
-
           XRenderFreePicture (GDK_DISPLAY (), picture);
           XSync (GDK_DISPLAY (), FALSE);
         }


More information about the maemo-commits mailing list