diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 537741bf2a..7e17aeea8a 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -285,6 +285,8 @@ struct _GdkWindow GdkFrameClock *frame_clock; /* NULL to use from parent or default */ GdkDrawingContext *drawing_context; + + cairo_region_t *opaque_region; }; #define GDK_WINDOW_TYPE(d) ((((GdkWindow *)(d)))->window_type) diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 010a27ea7d..09d136c37f 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -404,6 +404,9 @@ gdk_window_finalize (GObject *object) g_clear_object (&window->display); + if (window->opaque_region) + cairo_region_destroy (window->opaque_region); + G_OBJECT_CLASS (gdk_window_parent_class)->finalize (object); } @@ -8142,6 +8145,14 @@ gdk_window_set_opaque_region (GdkWindow *window, g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (!GDK_WINDOW_DESTROYED (window)); + if (cairo_region_equal (window->opaque_region, region)) + return; + + g_clear_pointer (&window->opaque_region, cairo_region_destroy); + + if (region != NULL) + window->opaque_region = cairo_region_reference (region); + impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl); if (impl_class->set_opaque_region)