diff options
author | Rui Matos <tiagomatos@gmail.com> | 2017-08-18 12:01:54 +0200 |
---|---|---|
committer | Rui Matos <tiagomatos@gmail.com> | 2017-08-18 19:01:00 +0200 |
commit | e702ee8fa68283ac68cc4b8338c413ce8c881bc2 (patch) | |
tree | 2c66c3354b94e217e296a561ea7abff8f4f648f9 /gdk | |
parent | e35266a6ae280e7cec32b837706cb6771250606e (diff) | |
download | gtk+-e702ee8fa68283ac68cc4b8338c413ce8c881bc2.tar.gz |
gdkwindow: Avoid re-setting the opaque region if it doesn't change
This avoids, at least, needless chatter with the compositor and the X
server in X11's case.
https://bugzilla.gnome.org/show_bug.cgi?id=786469
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkinternals.h | 2 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 11 |
2 files changed, 13 insertions, 0 deletions
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) |