[gtk+/client-side-windows: 98/284] do_move_region_bits_on_impl needs to copy from overlapping native windows too



commit df4f4c14c7db72fbe003c3c122efc6ae46001fd5
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Jan 20 22:29:19 2009 +0100

    do_move_region_bits_on_impl needs to copy from overlapping native windows too
    
    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 |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index f4e05b5..584e595 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]