[cairo-commit] goocanvas/src goocanvas.c,1.19,1.20

Damon Chaplin commit at pdx.freedesktop.org
Tue May 15 04:07:23 PDT 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv23378/src

Modified Files:
	goocanvas.c 
Log Message:
2007-05-15  Damon Chaplin  <damon at gnome.org>

	* src/goocanvas.c (goo_canvas_style_set, goo_canvas_realize): reset
	the window backgrounds to nothing, to avoid flicker when scrolling.
	(This happened due to the delay between X clearing the window and
	GooCanvas repainting it.)
	(goo_canvas_expose_event): clear the background ourselves here.



Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- goocanvas.c	14 May 2007 09:51:25 -0000	1.19
+++ goocanvas.c	15 May 2007 11:07:12 -0000	1.20
@@ -1110,12 +1110,15 @@
   gdk_window_set_user_data (canvas->tmp_window, widget);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
-  gdk_window_set_background (widget->window,
-			     &widget->style->base[widget->state]);
-  gdk_window_set_background (canvas->canvas_window,
-			     &widget->style->base[widget->state]);
+
+  /* Make sure the window backgrounds aren't set, to avoid flicker when
+     scrolling (due to the delay between X clearing the background and
+     GooCanvas painting it). */
+  gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
+  gdk_window_set_back_pixmap (canvas->canvas_window, NULL, FALSE);
   gdk_window_set_back_pixmap (canvas->tmp_window, NULL, FALSE);
 
+  /* Set the parent window of all the child widget items. */
   tmp_list = canvas->widget_items;
   while (tmp_list)
     {
@@ -1191,10 +1194,11 @@
 
   if (GTK_WIDGET_REALIZED (widget))
     {
-      gdk_window_set_background (widget->window,
-				 &widget->style->base[widget->state]);
-      gdk_window_set_background (GOO_CANVAS (widget)->canvas_window,
-				 &widget->style->base[widget->state]);
+      /* Make sure the window backgrounds aren't set, to avoid flicker when
+	 scrolling (due to the delay between X clearing the background and
+	 GooCanvas painting it). */
+      gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
+      gdk_window_set_back_pixmap (GOO_CANVAS (widget)->canvas_window, NULL, FALSE);
     }
 }
 
@@ -2035,6 +2039,12 @@
   if (event->window != canvas->canvas_window)
     return FALSE;
 
+  /* Clear the background. */
+  gdk_draw_rectangle (canvas->canvas_window,
+		      widget->style->base_gc[widget->state], TRUE,
+		      event->area.x, event->area.y,
+		      event->area.width, event->area.height);
+
   cr = goo_canvas_create_cairo_context (canvas);
 
   if (canvas->need_update)



More information about the cairo-commit mailing list