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
This commit is contained in:
Rui Matos 2017-08-18 12:01:54 +02:00
parent e35266a6ae
commit e702ee8fa6
2 changed files with 13 additions and 0 deletions

View File

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

View File

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