From 8a517dc0bb3299b1d6e9491d1f7e926a47deb305 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 13 Aug 2009 13:13:47 +0200 Subject: [PATCH] Modify window system exposes wrt outstanding moves If there are outstanding moves in an area that intersects the source of an outstanding move we need to move the invalid area correspondingly, otherwise we will expose the wrong area as the outstanding move copy will happen before we expose the invalid area. --- gdk/gdkinternals.h | 2 +- gdk/gdkwindow.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 75eb068856..a668e682bc 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -605,7 +605,7 @@ void _gdk_display_enable_motion_hints (GdkDisplay *display); void _gdk_window_invalidate_for_expose (GdkWindow *window, - const GdkRegion *region); + GdkRegion *region); void _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface, int width, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index cfb9d9edc9..04d8010061 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -5300,8 +5300,37 @@ gdk_window_invalidate_region (GdkWindow *window, **/ void _gdk_window_invalidate_for_expose (GdkWindow *window, - const GdkRegion *region) + GdkRegion *region) { + GdkWindowObject *private = (GdkWindowObject *) window; + GdkWindowRegionMove *move; + GdkRegion *move_region; + GList *l; + + /* Any invalidations comming from the windowing system will + be in areas that may be moved by outstanding moves, + so we need to modify the expose region correspondingly, + otherwise we would expose in the wrong place, as the + outstanding moves will be copied before we draw the + exposes. */ + for (l = private->outstanding_moves; l != NULL; l = l->next) + { + move = l->data; + + /* covert to move source region */ + move_region = gdk_region_copy (move->dest_region); + gdk_region_offset (move_region, -move->dx, -move->dy); + + /* Move area of region that intersects with move source + by dx, dy of the move*/ + gdk_region_intersect (move_region, region); + gdk_region_subtract (region, move_region); + gdk_region_offset (move_region, move->dx, move->dy); + gdk_region_union (region, move_region); + + gdk_region_destroy (move_region); + } + gdk_window_invalidate_maybe_recurse (window, region, (gboolean (*) (GdkWindow *, gpointer))gdk_window_has_no_impl, NULL);