[mutter] window-props: Don't make another round-trip to fetch the opaque region
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-props: Don't make another round-trip to fetch the opaque region
- Date: Mon, 14 Jul 2014 02:52:07 +0000 (UTC)
commit 39357fc242f6a02bab0af0176dc8d842b3d97020
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Jul 13 22:51:25 2014 -0400
window-props: Don't make another round-trip to fetch the opaque region
We already have the property value from our property fetching.
src/x11/window-props.c | 62 +++++++++++++++++++++++++++++++++++++++++-
src/x11/window-x11.c | 70 ------------------------------------------------
src/x11/window-x11.h | 1 -
3 files changed, 61 insertions(+), 72 deletions(-)
---
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index c0fc380..88c7beb 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -608,11 +608,71 @@ reload_wm_name (MetaWindow *window,
}
static void
+meta_window_set_opaque_region (MetaWindow *window,
+ cairo_region_t *region)
+{
+ 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);
+
+ meta_compositor_window_shape_changed (window->display->compositor, window);
+}
+
+static void
reload_opaque_region (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
- meta_window_x11_update_opaque_region (window);
+ cairo_region_t *opaque_region = NULL;
+
+ if (value->type != META_PROP_VALUE_INVALID)
+ {
+ gulong *region = value->v.cardinal_list.cardinals;
+ int nitems = value->v.cardinal_list.n_cardinals;
+
+ cairo_rectangle_int_t *rects;
+ int i, rect_index, nrects;
+
+ if (nitems % 4 != 0)
+ {
+ meta_verbose ("_NET_WM_OPAQUE_REGION does not have a list of 4-tuples.");
+ goto out;
+ }
+
+ /* empty region */
+ if (nitems == 0)
+ goto out;
+
+ nrects = nitems / 4;
+
+ rects = g_new (cairo_rectangle_int_t, nrects);
+
+ rect_index = 0;
+ i = 0;
+ while (i < nitems)
+ {
+ cairo_rectangle_int_t *rect = &rects[rect_index];
+
+ rect->x = region[i++];
+ rect->y = region[i++];
+ rect->width = region[i++];
+ rect->height = region[i++];
+
+ rect_index++;
+ }
+
+ opaque_region = cairo_region_create_rectangles (rects, nrects);
+
+ g_free (rects);
+ }
+
+ out:
+ meta_window_set_opaque_region (window, opaque_region);
+ cairo_region_destroy (opaque_region);
}
static void
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 4b48342..76098ec 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -1585,76 +1585,6 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
}
}
-static void
-meta_window_set_opaque_region (MetaWindow *window,
- cairo_region_t *region)
-{
- 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);
-
- meta_compositor_window_shape_changed (window->display->compositor, window);
-}
-
-void
-meta_window_x11_update_opaque_region (MetaWindow *window)
-{
- cairo_region_t *opaque_region = NULL;
- gulong *region = NULL;
- int nitems;
-
- if (meta_prop_get_cardinal_list (window->display,
- window->xwindow,
- window->display->atom__NET_WM_OPAQUE_REGION,
- ®ion, &nitems))
- {
- cairo_rectangle_int_t *rects;
- int i, rect_index, nrects;
-
- if (nitems % 4 != 0)
- {
- meta_verbose ("_NET_WM_OPAQUE_REGION does not have a list of 4-tuples.");
- goto out;
- }
-
- /* empty region */
- if (nitems == 0)
- goto out;
-
- nrects = nitems / 4;
-
- rects = g_new (cairo_rectangle_int_t, nrects);
-
- rect_index = 0;
- i = 0;
- while (i < nitems)
- {
- cairo_rectangle_int_t *rect = &rects[rect_index];
-
- rect->x = region[i++];
- rect->y = region[i++];
- rect->width = region[i++];
- rect->height = region[i++];
-
- rect_index++;
- }
-
- opaque_region = cairo_region_create_rectangles (rects, nrects);
-
- g_free (rects);
- }
-
- out:
- meta_XFree (region);
-
- meta_window_set_opaque_region (window, opaque_region);
- cairo_region_destroy (opaque_region);
-}
-
static cairo_region_t *
region_create_from_x_rectangles (const XRectangle *rects,
int n_rects)
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index affd15e..a2637a0 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -55,7 +55,6 @@ void meta_window_x11_destroy_sync_request_alarm (MetaWindow *window);
void meta_window_x11_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value);
-void meta_window_x11_update_opaque_region (MetaWindow *window);
void meta_window_x11_update_input_region (MetaWindow *window);
void meta_window_x11_update_shape_region (MetaWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]