[maemo-commits] [maemo-commits] r9672 - in projects/haf/trunk/sapwood: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Feb 6 14:28:45 EET 2007
Author: tko
Date: 2007-02-06 14:28:42 +0200 (Tue, 06 Feb 2007)
New Revision: 9672

Modified:
   projects/haf/trunk/sapwood/ChangeLog
   projects/haf/trunk/sapwood/src/sapwood-draw.c
Log:
Apply shape mask only when painting the whole window to avoid expose loop

2007-02-06  Tommi Komulainen  <tommi.komulainen at nokia.com>

	* src/sapwood-draw.c (draw_simple_image, get_window_for_shape): Check
	the paintable area size and apply the shape mask only when painting
	the whole window to avoid another case of infinite expose loop.


Modified: projects/haf/trunk/sapwood/ChangeLog
===================================================================
--- projects/haf/trunk/sapwood/ChangeLog	2007-02-06 12:23:02 UTC (rev 9671)
+++ projects/haf/trunk/sapwood/ChangeLog	2007-02-06 12:28:42 UTC (rev 9672)
@@ -1,3 +1,9 @@
+2007-02-06  Tommi Komulainen  <tommi.komulainen at nokia.com>
+
+	* src/sapwood-draw.c (draw_simple_image, get_window_for_shape): Check
+	the paintable area size and apply the shape mask only when painting
+	the whole window to avoid another case of infinite expose loop.
+  
 2007-01-31  Tommi Komulainen  <tommi.komulainen at nokia.com>
 
 	* src/sapwood-draw.c (draw_expander): Added to handle painting

Modified: projects/haf/trunk/sapwood/src/sapwood-draw.c
===================================================================
--- projects/haf/trunk/sapwood/src/sapwood-draw.c	2007-02-06 12:23:02 UTC (rev 9671)
+++ projects/haf/trunk/sapwood/src/sapwood-draw.c	2007-02-06 12:28:42 UTC (rev 9672)
@@ -105,7 +105,8 @@
 }
 
 static GdkBitmap *
-get_window_for_shape (ThemeImage *image, GdkWindow *window, GtkWidget *widget)
+get_window_for_shape (ThemeImage *image, GdkWindow *window, GtkWidget *widget,
+		      gint x, gint y, gint width, gint height)
 {
   /* It's not a good idea to set a shape mask when painting on anything but
    * widget->window, not only does the shape mask get wrongly offset but also
@@ -117,6 +118,22 @@
    */
   if (image->background_shaped && window == widget->window)
     {
+      gint window_width;
+      gint window_height;
+      /* It also is not a good idea to apply shape mask when filling a window
+       * partially.
+       *
+       * For example GtkMenu paints/painted the arrow backgrounds with exactly
+       * the same parameters as full window background - except for the
+       * geometry. (http://bugzilla.gnome.org/show_bug.cgi?id=404571)
+       */
+      if (x != 0 || y != 0)
+        return NULL;
+
+      gdk_drawable_get_size (window, &window_width, &window_height);
+      if (width != window_width || height != window_height)
+        return NULL;
+
       if (GTK_IS_MENU (widget))
 	return gtk_widget_get_parent_window (widget);
       else if (GTK_IS_WINDOW (widget))
@@ -233,7 +250,7 @@
 	  GdkBitmap *mask = NULL;
 	  gboolean valid;
 
-	  maskwin = get_window_for_shape (image, window, widget);
+	  maskwin = get_window_for_shape (image, window, widget, x, y, width, height);
 	  if (maskwin)
 	    mask = gdk_pixmap_new (maskwin, width, height, 1);
 


More information about the maemo-commits mailing list