diff --git a/src/ui/frames.c b/src/ui/frames.c index 9c4782ecd..7c62898df 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -764,6 +764,39 @@ meta_frames_unflicker_bg (MetaFrames *frames, set_background_none (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); } +#ifdef HAVE_SHAPE +static void +apply_cairo_region_to_window (Display *display, + Window xwindow, + cairo_region_t *region, + int op) +{ + int n_rects, i; + XRectangle *rects; + + n_rects = cairo_region_num_rectangles (region); + rects = g_new (XRectangle, n_rects); + + for (i = 0; i < n_rects; i++) + { + cairo_rectangle_int_t rect; + + cairo_region_get_rectangle (region, i, &rect); + + rects[i].x = rect.x; + rects[i].y = rect.y; + rects[i].width = rect.width; + rects[i].height = rect.height; + } + + XShapeCombineRectangles (display, xwindow, + ShapeBounding, 0, 0, rects, n_rects, + ShapeSet, YXBanded); + + g_free (rects); +} +#endif + void meta_frames_apply_shapes (MetaFrames *frames, Window xwindow, @@ -775,9 +808,9 @@ meta_frames_apply_shapes (MetaFrames *frames, /* Apply shapes as if window had new_window_width, new_window_height */ MetaUIFrame *frame; MetaFrameGeometry fgeom; - XRectangle xrect; - Region corners_xregion; - Region window_xregion; + cairo_rectangle_int_t rect; + cairo_region_t *corners_region; + cairo_region_t *window_region; Display *display; frame = meta_frames_lookup_window (frames, xwindow); @@ -813,7 +846,7 @@ meta_frames_apply_shapes (MetaFrames *frames, return; /* nothing to do */ } - corners_xregion = XCreateRegion (); + corners_region = cairo_region_create (); if (fgeom.top_left_corner_rounded_radius != 0) { @@ -824,12 +857,12 @@ meta_frames_apply_shapes (MetaFrames *frames, for (i=0; ixwindow, ShapeBounding, @@ -984,13 +1017,13 @@ meta_frames_apply_shapes (MetaFrames *frames, "Frame 0x%lx has shaped corners\n", frame->xwindow); - XShapeCombineRegion (display, frame->xwindow, - ShapeBounding, 0, 0, window_xregion, ShapeSet); + apply_cairo_region_to_window (display, frame->xwindow, + window_region, ShapeSet); } frame->shape_applied = TRUE; - XDestroyRegion (window_xregion); + cairo_region_destroy (window_region); #endif /* HAVE_SHAPE */ }