Ensure that queue_translation is paired with the right X operation

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().
This commit is contained in:
Alexander Larsson 2009-08-13 14:25:35 +02:00
parent e25ac0b5cb
commit 939e55223c
9 changed files with 18 additions and 5 deletions

View 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)

View 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)

View 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,

View 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);

View File

@ -24,6 +24,7 @@
void
_gdk_quartz_window_queue_translation (GdkWindow *window,
GdkGC *gc,
GdkRegion *area,
gint dx,
gint dy)

View 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);

View 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)

View 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);
}

View 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);