]> Pileus Git - ~andy/gtk/commitdiff
Ensure that queue_translation is paired with the right X operation
authorAlexander Larsson <alexl@redhat.com>
Thu, 13 Aug 2009 12:25:35 +0000 (14:25 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 13 Aug 2009 12:46:02 +0000 (14:46 +0200)
The X11 queue_translation operation uses NextRequest to get the serial
of the XCopyArea operation where the translation should end. However,
if the gc passed to gdk_draw_drawable has a non-flushed clip region
(which it commonly has now for the window clipping) then the next
operation will be the GC flush, not the XCopyArea.

To handle this right we now pass in the GC to be used to
queue_translation and ensure that it is flushed before calling
NextRequest().

gdk/directfb/gdkwindow-directfb.c
gdk/gdkoffscreenwindow.c
gdk/gdkwindow.c
gdk/gdkwindowimpl.h
gdk/quartz/gdkgeometry-quartz.c
gdk/quartz/gdkprivate-quartz.h
gdk/win32/gdkwindow-win32.c
gdk/x11/gdkgeometry-x11.c
gdk/x11/gdkprivate-x11.h

index 42196f732349f960ff519e533a5b322b59f9ff19..a7d3d304fd0c876842a0bb801af10bc4cd7ca47c 100644 (file)
@@ -1957,6 +1957,7 @@ gdk_directfb_window_input_shape_combine_region (GdkWindow       *window,
 
 static void
 gdk_directfb_window_queue_translation (GdkWindow *window,
+                                      GdkGC     *gc,
                                        GdkRegion *region,
                                        gint       dx,
                                        gint       dy)
index f14f831e8291f8f03d9765873f6420fe276b133f..0029708591fa0896ce0f2d41dd388fa4ad4724c2 100644 (file)
@@ -1149,6 +1149,7 @@ gdk_offscreen_window_queue_antiexpose (GdkWindow *window,
 
 static void
 gdk_offscreen_window_queue_translation (GdkWindow *window,
+                                       GdkGC     *gc,
                                        GdkRegion *area,
                                        gint       dx,
                                        gint       dy)
index eaca78100ff1a1ba63e13b49dbb0e88a216326fe..1c1bb32dadf16608fb83808f690663d8990f3641 100644 (file)
@@ -2828,16 +2828,16 @@ do_move_region_bits_on_impl (GdkWindowObject *impl_window,
     }
   tmp_gc = _gdk_drawable_get_subwindow_scratch_gc ((GdkWindow *)private);
 
+  gdk_region_get_clipbox (dest_region, &copy_rect);
+  gdk_gc_set_clip_region (tmp_gc, dest_region);
+
   /* The region area is moved and we queue translations for all expose events
      to the source area that were sent prior to the copy */
-  gdk_region_offset (dest_region, -dx, -dy); /* Temporarily move to source area */
+  gdk_region_offset (dest_region, -dx, -dy); /* Move to source region */
   GDK_WINDOW_IMPL_GET_IFACE (private->impl)->queue_translation ((GdkWindow *)impl_window,
+                                                               tmp_gc,
                                                                dest_region, dx, dy);
-  gdk_region_offset (dest_region, dx, dy); /* back to dest area */
 
-  gdk_region_get_clipbox (dest_region, &copy_rect);
-
-  gdk_gc_set_clip_region (tmp_gc, dest_region);
   gdk_draw_drawable (impl_window->impl,
                     tmp_gc,
                     private->impl,
index ad1ae6b5e3045c7b85bb4a5c992ca3ddbcac7b3a..b8de4744d1b15a4865e18343a0f6696f6bebd262 100644 (file)
@@ -118,6 +118,7 @@ struct _GdkWindowImplIface
   gboolean     (* queue_antiexpose)     (GdkWindow       *window,
                                         GdkRegion       *update_area);
   void         (* queue_translation)    (GdkWindow       *window,
+                                        GdkGC           *gc,
                                         GdkRegion       *area,
                                         gint            dx,
                                         gint            dy);
index eceb0717f068244fe55cf73083c963f823934ba1..3e0a26f2b1710a7f135e79a9019bf93b45c90f17 100644 (file)
@@ -24,6 +24,7 @@
 
 void
 _gdk_quartz_window_queue_translation (GdkWindow *window,
+                                     GdkGC     *gc,
                                       GdkRegion *area,
                                       gint       dx,
                                       gint       dy)
index 9590d9b561d115e50692ec6a19bfaa7a5abe28fe..2152b6ea43a4ef9c68dce8e39fac946dbd71eee9 100644 (file)
@@ -187,6 +187,7 @@ void        _gdk_quartz_window_scroll      (GdkWindow       *window,
                                             gint             dx,
                                             gint             dy);
 void        _gdk_quartz_window_queue_translation (GdkWindow *window,
+                                                 GdkGC     *gc,
                                                   GdkRegion *area,
                                                   gint       dx,
                                                   gint       dy);
index d3414495d411ed40e2810cdb11e8b777ee1e691e..1380f0bd98d5b713ea3fd2db58fbeb483a018739 100644 (file)
@@ -3576,6 +3576,7 @@ _gdk_win32_window_queue_antiexpose (GdkWindow *window,
  */
 static void
 _gdk_win32_window_queue_translation (GdkWindow *window,
+                                    GdkGC     *gc,
                                     GdkRegion *area,
                                     gint       dx,
                                     gint       dy)
index b00ef0558f881972d5e256a7afdeee534fb1d328..8efeea975c985d215ea0555cc1b06adbc9400cb6 100644 (file)
@@ -231,6 +231,7 @@ gdk_window_queue (GdkWindow          *window,
 
 void
 _gdk_x11_window_queue_translation (GdkWindow *window,
+                                  GdkGC     *gc,
                                   GdkRegion *area,
                                   gint       dx,
                                   gint       dy)
@@ -241,6 +242,11 @@ _gdk_x11_window_queue_translation (GdkWindow *window,
   item->u.translate.dx = dx;
   item->u.translate.dy = dy;
 
+  /* Ensure that the gc is flushed so that we get the right
+     serial from NextRequest in gdk_window_queue, i.e. the
+     the serial for the XCopyArea, not the ones from flushing
+     the gc. */
+  _gdk_x11_gc_flush (gc);
   gdk_window_queue (window, item);
 }
 
index 871fa74fd3723fd988025eb8392361c4d4453883..bfbf3d9bdd5a4eb5250a7fd307ced2cda4e101b8 100644 (file)
@@ -130,6 +130,7 @@ void _gdk_window_process_expose    (GdkWindow     *window,
 gboolean _gdk_x11_window_queue_antiexpose  (GdkWindow *window,
                                            GdkRegion *area);
 void     _gdk_x11_window_queue_translation (GdkWindow *window,
+                                           GdkGC     *gc,
                                            GdkRegion *area,
                                            gint       dx,
                                            gint       dy);