[maemo-commits] [maemo-commits] r18124 - in projects/haf/trunk/gtk+: . gdk gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Apr 21 15:39:54 EEST 2009
Author: mitch
Date: 2009-04-21 15:39:36 +0300 (Tue, 21 Apr 2009)
New Revision: 18124

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gdk/gdkwindow.c
   projects/haf/trunk/gtk+/gtk/gtkwidget.c
Log:
2009-04-21  Michael Natterer  <mitch at imendio.com>

	Addresses: NB#102653 - Bad performance of GtkViewport in
	HildonPannable while animating

	Merged from upstream:

    2009-01-23  Matthias Clasen  <mclasen at redhat.com>

	Bug 566535 ?\226?\128?\147 gtk_widget_get_snapshot does not work if double buffered 
	is disabled

	* gtk/gtkwidget.c (gtk_widget_get_snapshot): Use a different approach
	to snapshotting that is in line with what is done in the client-side
	windows branch, and that works for widgets regardless if they are
	double-buffered or not. Patch by Alex Larsson.

	* gdk/gdkwindow.c (_gdk_window_calculate_full_clip_region): Clip
	to the parent.



Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2009-04-21 12:11:03 UTC (rev 18123)
+++ projects/haf/trunk/gtk+/ChangeLog	2009-04-21 12:39:36 UTC (rev 18124)
@@ -1,3 +1,23 @@
+2009-04-21  Michael Natterer  <mitch at imendio.com>
+
+	Addresses: NB#102653 - Bad performance of GtkViewport in
+	HildonPannable while animating
+
+	Merged from upstream:
+
+    2009-01-23  Matthias Clasen  <mclasen at redhat.com>
+
+	Bug 566535 – gtk_widget_get_snapshot does not work if double buffered 
+	is disabled
+
+	* gtk/gtkwidget.c (gtk_widget_get_snapshot): Use a different approach
+	to snapshotting that is in line with what is done in the client-side
+	windows branch, and that works for widgets regardless if they are
+	double-buffered or not. Patch by Alex Larsson.
+
+	* gdk/gdkwindow.c (_gdk_window_calculate_full_clip_region): Clip
+	to the parent.
+
 2009-04-17  Claudio Saavedra  <csaavedra at igalia.com>
 
 	Released 2:2.12.12-1maemo14

Modified: projects/haf/trunk/gtk+/gdk/gdkwindow.c
===================================================================
--- projects/haf/trunk/gtk+/gdk/gdkwindow.c	2009-04-21 12:11:03 UTC (rev 18123)
+++ projects/haf/trunk/gtk+/gdk/gdkwindow.c	2009-04-21 12:39:36 UTC (rev 18124)
@@ -4421,6 +4421,15 @@
 	  gdk_region_destroy (tmpreg);
 	}
       
+      /* Clip to the parent */
+      window_get_size_rectangle ((GdkWindow *)parentwin, &visible_rect);
+      /* Convert rect to "window" coords */
+      visible_rect.x += - x_offset;
+      visible_rect.y += - y_offset;
+      
+      tmpreg = gdk_region_rectangle (&visible_rect);
+      gdk_region_intersect (real_clip_region, tmpreg);
+      gdk_region_destroy (tmpreg);
     }
 
   if (gc)

Modified: projects/haf/trunk/gtk+/gtk/gtkwidget.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkwidget.c	2009-04-21 12:11:03 UTC (rev 18123)
+++ projects/haf/trunk/gtk+/gtk/gtkwidget.c	2009-04-21 12:39:36 UTC (rev 18124)
@@ -8623,6 +8623,55 @@
   g_object_unref ((GObject*) widget);
 }
 
+static void
+expose_window (GdkWindow *window)
+{
+  GdkEvent event;
+  GList *l, *children;
+  gpointer user_data;
+  gboolean is_double_buffered;
+
+  gdk_window_get_user_data (window, &user_data);
+
+  if (user_data)
+    is_double_buffered = GTK_WIDGET_DOUBLE_BUFFERED (GTK_WIDGET (user_data));
+  else
+    is_double_buffered = FALSE;
+  
+  event.expose.type = GDK_EXPOSE;
+  event.expose.window = g_object_ref (window);
+  event.expose.send_event = FALSE;
+  event.expose.count = 0;
+  event.expose.area.x = 0;
+  event.expose.area.y = 0;
+  gdk_drawable_get_size (GDK_DRAWABLE (window),
+			 &event.expose.area.width,
+			 &event.expose.area.height);
+  event.expose.region = gdk_region_rectangle (&event.expose.area);
+
+  /* If this is not double buffered, force a double buffer so that
+     redirection works. */
+  if (!is_double_buffered)
+    gdk_window_begin_paint_region (window, event.expose.region);
+  
+  gtk_main_do_event (&event);
+
+  if (!is_double_buffered)
+    gdk_window_end_paint (window);
+  
+  children = gdk_window_peek_children (window);
+  for (l = children; l != NULL; l = l->next)
+    {
+      GdkWindow *child = l->data;
+
+      /* Don't expose input-only windows */
+      if (gdk_drawable_get_depth (GDK_DRAWABLE (child)) != 0)
+	expose_window (l->data);
+    }
+  
+  g_object_unref (window);
+}
+
 /**
  * gtk_widget_get_snapshot:
  * @widget:    a #GtkWidget
@@ -8752,23 +8801,20 @@
     {
       GdkWindow *subwin = list->data;
       int wx, wy;
+      if (gdk_drawable_get_depth (GDK_DRAWABLE (subwin)) == 0)
+	continue; /* Input only window */
       gdk_window_get_position (subwin, &wx, &wy);
       gdk_window_redirect_to_drawable (subwin, pixmap, MAX (0, x - wx), MAX (0, y - wy),
                                        MAX (0, wx - x), MAX (0, wy - y), width, height);
-      gdk_window_invalidate_rect (subwin, NULL, TRUE);
+
+      expose_window (subwin);
     }
   if (!windows) /* NO_WINDOW || toplevel => parent_window == NULL || parent_window == widget->window */
     {
       gdk_window_redirect_to_drawable (widget->window, pixmap, x, y, 0, 0, width, height);
-      gdk_window_invalidate_rect (widget->window, NULL, TRUE);
+      expose_window (widget->window);
     }
-  gtk_widget_queue_draw (widget);
-  if (parent_window)
-    gdk_window_process_updates (parent_window, TRUE);
   for (list = windows; list; list = list->next)
-    gdk_window_process_updates (list->data, TRUE);
-  gdk_window_process_updates (widget->window, TRUE);
-  for (list = windows; list; list = list->next)
     gdk_window_remove_redirection (list->data);
   if (!windows) /* NO_WINDOW || toplevel */
     gdk_window_remove_redirection (widget->window);


More information about the maemo-commits mailing list