[metacity/wip/invisible-borders: 24/25] compositor: fix border_size
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity/wip/invisible-borders: 24/25] compositor: fix border_size
- Date: Tue, 20 Jan 2015 13:14:34 +0000 (UTC)
commit ccbfd9679783f65349f6a1b4838b857d333e0cfc
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Jan 20 05:02:26 2015 +0200
compositor: fix border_size
src/compositor/compositor-xrender.c | 52 +++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index 38ac0d9..0e59ff3 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -1079,13 +1079,52 @@ win_extents (MetaCompWindow *cw)
}
static XserverRegion
+cairo_region_to_xregion (Display *xdisplay,
+ cairo_region_t *region)
+{
+ int n_rects, i;
+ XRectangle *rects;
+ XserverRegion xregion;
+
+ 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;
+ }
+
+ xregion = XFixesCreateRegion (xdisplay, rects, n_rects);
+ g_free (rects);
+
+ return xregion;
+}
+
+static XserverRegion
border_size (MetaCompWindow *cw)
{
MetaScreen *screen = cw->screen;
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
+ cairo_region_t *visible_region;
+ XserverRegion visible = None;
XserverRegion border;
+ if (cw->window)
+ {
+ visible_region = meta_window_get_frame_bounds (cw->window);
+
+ if (visible_region)
+ visible = cairo_region_to_xregion (xdisplay, visible_region);
+ }
+
meta_error_trap_push (display);
border = XFixesCreateRegionFromWindow (xdisplay, cw->id,
WindowRegionBounding);
@@ -1095,6 +1134,19 @@ border_size (MetaCompWindow *cw)
XFixesTranslateRegion (xdisplay, border,
cw->attrs.x + cw->attrs.border_width,
cw->attrs.y + cw->attrs.border_width);
+
+ if (visible != None)
+ {
+ XFixesTranslateRegion (xdisplay, visible,
+ cw->attrs.x + cw->attrs.border_width,
+ cw->attrs.y + cw->attrs.border_width);
+
+ XFixesIntersectRegion (xdisplay, visible, visible, border);
+ XFixesDestroyRegion (xdisplay, border);
+
+ return visible;
+ }
+
return border;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]