[maemo-commits] [maemo-commits] r19120 - in projects/haf/trunk/sapwood: . engine

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Aug 11 16:11:05 EEST 2009
Author: herzi
Date: 2009-08-11 16:10:53 +0300 (Tue, 11 Aug 2009)
New Revision: 19120

Modified:
   projects/haf/trunk/sapwood/ChangeLog
   projects/haf/trunk/sapwood/engine/sapwood-main.c
   projects/haf/trunk/sapwood/engine/sapwood-pixmap.c
   projects/haf/trunk/sapwood/engine/sapwood-pixmap.h
   projects/haf/trunk/sapwood/engine/theme-pixbuf.c
Log:
2009-08-07  Alejandro G. Castro  <alex at igalia.com>

	Added a new debug enviroment option to enable the synchronous X
	error handling.

	* engine/sapwood-main.c,
	(theme_init): Captured the new "xtraps" option in a new boolean
	variable.
	* engine/sapwood-pixmap.h:
	* engine/sapwood-pixmap.c,
	(sapwood_pixmap_get_for_file):
	* engine/theme-pixbuf.c,
	(theme_pixbuf_render): Added conditions to avoid gdk_flush if the
	xtraps debug option is not actived.

	Fixes: NB#131431 (gdk_flush in sapwood is causing tearing)


Modified: projects/haf/trunk/sapwood/ChangeLog
===================================================================
--- projects/haf/trunk/sapwood/ChangeLog	2009-08-11 13:02:15 UTC (rev 19119)
+++ projects/haf/trunk/sapwood/ChangeLog	2009-08-11 13:10:53 UTC (rev 19120)
@@ -1,3 +1,20 @@
+2009-08-07  Alejandro G. Castro  <alex at igalia.com>
+
+	Added a new debug enviroment option to enable the synchronous X
+	error handling.
+
+	* engine/sapwood-main.c,
+	(theme_init): Captured the new "xtraps" option in a new boolean
+	variable.
+	* engine/sapwood-pixmap.h:
+	* engine/sapwood-pixmap.c,
+	(sapwood_pixmap_get_for_file):
+	* engine/theme-pixbuf.c,
+	(theme_pixbuf_render): Added conditions to avoid gdk_flush if the
+	xtraps debug option is not actived.
+
+	Fixes: NB#131431 (gdk_flush in sapwood is causing tearing)
+
 2009-08-06  Claudio Saavedra  <csaavedra at igalia.com>
 
 	* tests/large-window.gtkrc: Relicense to make it

Modified: projects/haf/trunk/sapwood/engine/sapwood-main.c
===================================================================
--- projects/haf/trunk/sapwood/engine/sapwood-main.c	2009-08-11 13:02:15 UTC (rev 19119)
+++ projects/haf/trunk/sapwood/engine/sapwood-main.c	2009-08-11 13:10:53 UTC (rev 19120)
@@ -28,13 +28,21 @@
 #include "sapwood-rc-style.h"
 #include <gmodule.h>
 
+guint sapwood_debug_flags = 0;
 gboolean sapwood_debug_scaling = FALSE;
+gboolean sapwood_debug_xtraps = FALSE;
 
+typedef enum {
+  SAPWOOD_DEBUG_SCALING   = 1 << 0,
+  SAPWOOD_DEBUG_XTRAPS    = 1 << 1
+} SapwoodDebugFlag;
+
 G_MODULE_EXPORT void
 theme_init (GTypeModule *module)
 {
   GDebugKey keys[] = {
-    {"scaling", TRUE}
+    {"scaling", SAPWOOD_DEBUG_SCALING},
+    {"xtraps", SAPWOOD_DEBUG_XTRAPS}
   };
   const gchar* debug;
 
@@ -43,7 +51,11 @@
 
   debug = g_getenv ("SAPWOOD_DEBUG");
   if (debug)
-    sapwood_debug_scaling = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
+    {
+      sapwood_debug_flags = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
+      sapwood_debug_scaling = sapwood_debug_flags & SAPWOOD_DEBUG_SCALING;
+      sapwood_debug_xtraps = sapwood_debug_flags & SAPWOOD_DEBUG_XTRAPS;
+    }
 }
 
 G_MODULE_EXPORT void

Modified: projects/haf/trunk/sapwood/engine/sapwood-pixmap.c
===================================================================
--- projects/haf/trunk/sapwood/engine/sapwood-pixmap.c	2009-08-11 13:02:15 UTC (rev 19119)
+++ projects/haf/trunk/sapwood/engine/sapwood-pixmap.c	2009-08-11 13:10:53 UTC (rev 19120)
@@ -155,7 +155,10 @@
               {
                 g_assert_not_reached ();
               }
-	    gdk_flush ();
+
+            if (sapwood_debug_xtraps)
+              gdk_flush ();
+
 	    if ((xerror = gdk_error_trap_pop ()) || !pixmap)
 	      {
 		g_warning ("%s: pixmap[%d][%d]: gdk_pixmap_foreign_new(%x) failed, X error = %d",
@@ -170,7 +173,10 @@
 	  {
 	    gdk_error_trap_push ();
 	    pixmask = gdk_pixmap_foreign_new (rep.pixmask[i][j]);
-	    gdk_flush ();
+
+            if (sapwood_debug_xtraps)
+              gdk_flush ();
+
 	    if ((xerror = gdk_error_trap_pop ()) || !pixmask)
 	      {
 		g_warning ("%s: pixmask[%d][%d]: gdk_pixmap_foreign_new(%x) failed, X error = %d", 

Modified: projects/haf/trunk/sapwood/engine/sapwood-pixmap.h
===================================================================
--- projects/haf/trunk/sapwood/engine/sapwood-pixmap.h	2009-08-11 13:02:15 UTC (rev 19119)
+++ projects/haf/trunk/sapwood/engine/sapwood-pixmap.h	2009-08-11 13:10:53 UTC (rev 19120)
@@ -72,6 +72,7 @@
 				      SapwoodRect   *rects) G_GNUC_INTERNAL;
 
 G_GNUC_INTERNAL extern gboolean sapwood_debug_scaling;
+G_GNUC_INTERNAL extern gboolean sapwood_debug_xtraps;
 
 G_END_DECLS
 

Modified: projects/haf/trunk/sapwood/engine/theme-pixbuf.c
===================================================================
--- projects/haf/trunk/sapwood/engine/theme-pixbuf.c	2009-08-11 13:02:15 UTC (rev 19119)
+++ projects/haf/trunk/sapwood/engine/theme-pixbuf.c	2009-08-11 13:10:53 UTC (rev 19120)
@@ -388,7 +388,9 @@
 
 	  mask = gdk_pixmap_new (NULL, mask_width, mask_height, 1);
 
-	  gdk_flush ();
+          if (sapwood_debug_xtraps)
+            gdk_flush ();
+
 	  if (gdk_error_trap_pop ())
 	    {
 	      if (clip_rect)

More information about the maemo-commits mailing list