diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index c1b3083d75..03bba91188 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -160,6 +160,8 @@ void _gdk_quartz_window_debug_highlight (GdkWindow *window, void _gdk_quartz_window_set_needs_display_in_rect (GdkWindow *window, GdkRectangle *rect); +void _gdk_quartz_window_set_needs_display_in_region (GdkWindow *window, + GdkRegion *region); void _gdk_quartz_window_update_position (GdkWindow *window); diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 6cf54a8952..2daf9d7770 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -373,12 +373,37 @@ _gdk_quartz_window_set_needs_display_in_rect (GdkWindow *window, } void -_gdk_windowing_window_process_updates_recurse (GdkWindow *window, - GdkRegion *region) +_gdk_quartz_window_set_needs_display_in_region (GdkWindow *window, + GdkRegion *region) { + GdkWindowObject *private; + GdkWindowImplQuartz *impl; int i, n_rects; GdkRectangle *rects; + private = GDK_WINDOW_OBJECT (window); + impl = GDK_WINDOW_IMPL_QUARTZ (private->impl); + + if (!impl->needs_display_region) + impl->needs_display_region = gdk_region_new (); + + gdk_region_union (impl->needs_display_region, region); + + gdk_region_get_rectangles (region, &rects, &n_rects); + + for (i = 0; i < n_rects; i++) + [impl->view setNeedsDisplayInRect:NSMakeRect (rects[i].x, rects[i].y, + rects[i].width, + rects[i].height)]; + + g_free (rects); + +} + +void +_gdk_windowing_window_process_updates_recurse (GdkWindow *window, + GdkRegion *region) +{ /* Make sure to only flush each toplevel at most once if we're called * from process_all_updates. */ @@ -410,14 +435,7 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window, } if (WINDOW_IS_TOPLEVEL (window)) - { - gdk_region_get_rectangles (region, &rects, &n_rects); - - for (i = 0; i < n_rects; i++) - _gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]); - - g_free (rects); - } + _gdk_quartz_window_set_needs_display_in_region (window, region); else _gdk_window_process_updates_recurse (window, region);