]> Pileus Git - ~andy/gtk/commitdiff
do_move_region_bits_on_impl needs to copy from overlapping native windows too
authorAlexander Larsson <alexl@redhat.com>
Tue, 20 Jan 2009 21:29:19 +0000 (22:29 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:15:20 +0000 (10:15 +0200)
It can happen that another native window is re-shaped over the region to
be moved, this will not destroy the data (since we're unsetting the background
when we reshape), but it will mean we need to read from this window.

We already used INCLUDE_INFERIORS, but that only handle subwindows. We fix
this by doing the copy on the toplevel, offsetting the copy to compensate for
this.

gdk/gdkwindow.c

index f4e05b50766671442e71091a59174f51f270f0e9..584e5953191e9bb7c284cb14b9a1c56b14b4945a 100644 (file)
@@ -2447,9 +2447,21 @@ do_move_region_bits_on_impl (GdkWindowObject *private,
   
   gdk_region_get_clipbox (region, &copy_rect);
   gdk_region_offset (region, -dest_off_x, -dest_off_y);
+
   /* We need to get data from subwindows here, because we might have
-     moved or shaped a native window over the moving region (with bg none,
-     so the pixels are still there). */
+   * shaped a native window over the moving region (with bg none,
+   * so the pixels are still there). In fact we might need to get data
+   * from overlapping native window that are not children of this window,
+   * so we copy from the toplevel with INCLUDE_INFERIORS.
+   */
+  private = gdk_window_get_impl_window (private);
+  while (private->parent != NULL &&
+        GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
+    {
+      dx -= private->parent->abs_x + private->x;
+      dy -= private->parent->abs_y + private->y;
+      private = gdk_window_get_impl_window (private->parent);
+    }
   tmp_gc = _gdk_drawable_get_subwindow_scratch_gc ((GdkWindow *)private);
   gdk_gc_set_clip_region (tmp_gc, region);
   gdk_draw_drawable (dest,