[gtk+] gdkwindow: Avoid re-setting the opaque region if it doesn't change
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdkwindow: Avoid re-setting the opaque region if it doesn't change
- Date: Fri, 18 Aug 2017 17:25:04 +0000 (UTC)
commit e702ee8fa68283ac68cc4b8338c413ce8c881bc2
Author: Rui Matos <tiagomatos gmail com>
Date: Fri Aug 18 12:01:54 2017 +0200
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
gdk/gdkinternals.h | 2 ++
gdk/gdkwindow.c | 11 +++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 537741b..7e17aee 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 010a27e..09d136c 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]