[metacity] window: change opaque_region type to XserverRegion
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] window: change opaque_region type to XserverRegion
- Date: Sun, 13 Oct 2019 18:49:42 +0000 (UTC)
commit 773b6212ca76863e9b367af971678e4392fa3b95
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Oct 12 19:31:19 2019 +0300
window: change opaque_region type to XserverRegion
src/core/window-private.h | 4 ++--
src/core/window-props.c | 43 ++++++++++++++++++++++++++++---------------
src/core/window.c | 8 ++++++--
3 files changed, 36 insertions(+), 19 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index dfb67633..6bb47f2b 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -351,8 +351,8 @@ struct _MetaWindow
/* if non-None, the bounding shape region of the window */
XserverRegion shape_region;
- /* if non-NULL, the opaque region _NET_WM_OPAQUE_REGION */
- cairo_region_t *opaque_region;
+ /* if non-None, the opaque region _NET_WM_OPAQUE_REGION */
+ XserverRegion opaque_region;
/* _NET_WM_WINDOW_OPACITY */
guint opacity;
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 32f47614..ef877f24 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -721,16 +721,27 @@ reload_wm_name (MetaWindow *window,
}
static void
-meta_window_set_opaque_region (MetaWindow *window,
- cairo_region_t *region)
+meta_window_set_opaque_region (MetaWindow *window,
+ XserverRegion region)
{
- if (cairo_region_equal (window->opaque_region, region))
+ Display *xdisplay;
+
+ xdisplay = window->display->xdisplay;
+
+ if (meta_xserver_region_equal (xdisplay, window->opaque_region, region))
return;
- g_clear_pointer (&window->opaque_region, cairo_region_destroy);
+ if (window->opaque_region != None)
+ {
+ XFixesDestroyRegion (xdisplay, window->opaque_region);
+ window->opaque_region = None;
+ }
- if (region != NULL)
- window->opaque_region = cairo_region_reference (region);
+ if (region != None)
+ {
+ window->opaque_region = XFixesCreateRegion (xdisplay, NULL, 0);
+ XFixesCopyRegion (xdisplay, window->opaque_region, region);
+ }
meta_compositor_window_opaque_region_changed (window->display->compositor, window);
}
@@ -742,12 +753,13 @@ reload_opaque_region (MetaWindow *window,
{
int nitems, nrects, rect_index, i;
gulong *region;
- cairo_rectangle_int_t *rects;
- cairo_region_t *opaque_region;
+ XRectangle *rects;
+ Display *xdisplay;
+ XserverRegion opaque_region;
if (value->type == META_PROP_VALUE_INVALID)
{
- meta_window_set_opaque_region (window, NULL);
+ meta_window_set_opaque_region (window, None);
return;
}
@@ -757,24 +769,24 @@ reload_opaque_region (MetaWindow *window,
if (nitems % 4 != 0)
{
meta_verbose ("_NET_WM_OPAQUE_REGION does not have a list of 4-tuples.");
- meta_window_set_opaque_region (window, NULL);
+ meta_window_set_opaque_region (window, None);
return;
}
/* empty region */
if (nitems == 0)
{
- meta_window_set_opaque_region (window, NULL);
+ meta_window_set_opaque_region (window, None);
return;
}
nrects = nitems / 4;
- rects = g_new (cairo_rectangle_int_t, nrects);
+ rects = g_new (XRectangle, nrects);
rect_index = i = 0;
while (i < nitems)
{
- cairo_rectangle_int_t *rect;
+ XRectangle *rect;
rect = &rects[rect_index];
@@ -786,11 +798,12 @@ reload_opaque_region (MetaWindow *window,
rect_index++;
}
- opaque_region = cairo_region_create_rectangles (rects, nrects);
+ xdisplay = window->display->xdisplay;
+ opaque_region = XFixesCreateRegion (xdisplay, rects, nrects);
g_free (rects);
meta_window_set_opaque_region (window, opaque_region);
- cairo_region_destroy (opaque_region);
+ XFixesDestroyRegion (xdisplay, opaque_region);
}
static void
diff --git a/src/core/window.c b/src/core/window.c
index c632d14b..f45374f7 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -524,7 +524,7 @@ meta_window_new (MetaDisplay *display,
window->attached = FALSE;
window->frame_bounds = NULL;
window->shape_region = None;
- window->opaque_region = NULL;
+ window->opaque_region = None;
window->opacity = 0xffffffff;
window->unmaps_pending = 0;
@@ -9271,7 +9271,11 @@ meta_window_finalize (GObject *object)
window->shape_region = None;
}
- g_clear_pointer (&window->opaque_region, cairo_region_destroy);
+ if (window->opaque_region != None)
+ {
+ XFixesDestroyRegion (xdisplay, window->opaque_region);
+ window->opaque_region = None;
+ }
meta_icon_cache_free (&window->icon_cache);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]