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 690bfacb16
commit d17aeec08c
2 changed files with 13 additions and 0 deletions

View File

@ -386,6 +386,8 @@ struct _GdkWindow
GdkWindowInvalidateHandlerFunc invalidate_handler;
GdkDrawingContext *drawing_context;
cairo_region_t *opaque_region;
};
#define GDK_WINDOW_TYPE(d) ((((GdkWindow *)(d)))->window_type)

View File

@ -588,6 +588,9 @@ gdk_window_finalize (GObject *object)
if (window->devices_inside)
g_list_free (window->devices_inside);
if (window->opaque_region)
cairo_region_destroy (window->opaque_region);
G_OBJECT_CLASS (gdk_window_parent_class)->finalize (object);
}
@ -11879,6 +11882,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)