summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-04-16 16:26:01 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-04-16 16:57:09 +0300
commit01671766108466708f931e0ca5afbb7310162c90 (patch)
treeeede470218cf0cc9336a41622374b3385d382152
parente25f26df20756c73477db5d112e4348446a33e38 (diff)
downloadmetacity-01671766108466708f931e0ca5afbb7310162c90.tar.gz
compositor: use window mask in paint_windows
-rw-r--r--src/compositor/compositor-xrender.c84
1 files changed, 69 insertions, 15 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index b0e9c5a3..cbf72114 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -1589,17 +1589,24 @@ paint_windows (MetaScreen *screen,
if (cw->mode == WINDOW_SOLID)
{
int x, y, wid, hei;
+ MetaFrame *frame;
+ MetaFrameBorders borders;
x = cw->attrs.x;
y = cw->attrs.y;
wid = cw->attrs.width + cw->attrs.border_width * 2;
hei = cw->attrs.height + cw->attrs.border_width * 2;
+ frame = cw->window ? meta_window_get_frame (cw->window) : NULL;
+ meta_frame_calc_borders (frame, &borders);
+
XFixesSetPictureClipRegion (xdisplay, root_buffer,
0, 0, paint_region);
- XRenderComposite (xdisplay, PictOpSrc, cw->picture,
- None, root_buffer, 0, 0, 0, 0,
- x, y, wid, hei);
+ XRenderComposite (xdisplay, PictOpSrc, cw->picture, None, root_buffer,
+ borders.total.left, borders.total.top, 0, 0,
+ x + borders.total.left, y + borders.total.top,
+ wid - borders.total.left - borders.total.right,
+ hei - borders.total.top - borders.total.bottom);
if (cw->type == META_COMP_WINDOW_DESKTOP)
{
@@ -1607,8 +1614,16 @@ paint_windows (MetaScreen *screen,
XFixesCopyRegion (xdisplay, desktop_region, paint_region);
}
- XFixesSubtractRegion (xdisplay, paint_region,
- paint_region, cw->window_region);
+ if (frame == NULL)
+ {
+ XFixesSubtractRegion (xdisplay, paint_region,
+ paint_region, cw->window_region);
+ }
+ else
+ {
+ XFixesSubtractRegion (xdisplay, paint_region,
+ paint_region, cw->client_region);
+ }
}
if (!cw->border_clip)
@@ -1635,6 +1650,13 @@ paint_windows (MetaScreen *screen,
if (cw->picture)
{
+ int x, y, wid, hei;
+
+ x = cw->attrs.x;
+ y = cw->attrs.y;
+ wid = cw->attrs.width + cw->attrs.border_width * 2;
+ hei = cw->attrs.height + cw->attrs.border_width * 2;
+
if (cw->shadow && cw->type != META_COMP_WINDOW_DOCK)
{
XserverRegion shadow_clip;
@@ -1646,11 +1668,10 @@ paint_windows (MetaScreen *screen,
shadow_clip);
XRenderComposite (xdisplay, PictOpOver, info->black_picture,
- cw->shadow, root_buffer,
- 0, 0, 0, 0,
- cw->attrs.x + cw->shadow_dx,
- cw->attrs.y + cw->shadow_dy,
+ cw->shadow, root_buffer, 0, 0, 0, 0,
+ x + cw->shadow_dx, y + cw->shadow_dy,
cw->shadow_width, cw->shadow_height);
+
if (shadow_clip)
XFixesDestroyRegion (xdisplay, shadow_clip);
}
@@ -1666,15 +1687,48 @@ paint_windows (MetaScreen *screen,
cw->window_region);
XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0,
cw->border_clip);
- if (cw->mode == WINDOW_ARGB)
+
+ if (cw->mode == WINDOW_SOLID && cw->mask != None)
+ {
+ XRenderComposite (xdisplay, PictOpOver, cw->mask,
+ cw->alpha_pict, root_buffer, 0, 0, 0, 0,
+ x, y, wid, hei);
+
+ XRenderComposite (xdisplay, PictOpAdd, cw->picture,
+ None, root_buffer, 0, 0, 0, 0,
+ x, y, wid, hei);
+ }
+ else if (cw->mode == WINDOW_ARGB && cw->mask != None)
{
- int x, y, wid, hei;
+ XserverRegion clip;
+ XserverRegion client;
+
+ clip = XFixesCreateRegion (xdisplay, NULL, 0);
+ client = cw->client_region;
- x = cw->attrs.x;
- y = cw->attrs.y;
- wid = cw->attrs.width + cw->attrs.border_width * 2;
- hei = cw->attrs.height + cw->attrs.border_width * 2;
+ XFixesSubtractRegion (xdisplay, clip, cw->border_clip, client);
+ XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, clip);
+ XRenderComposite (xdisplay, PictOpOver, cw->mask,
+ cw->alpha_pict, root_buffer, 0, 0, 0, 0,
+ x, y, wid, hei);
+
+ XRenderComposite (xdisplay, PictOpAdd, cw->picture,
+ None, root_buffer, 0, 0, 0, 0,
+ x, y, wid, hei);
+
+ XFixesIntersectRegion (xdisplay, clip, cw->border_clip, client);
+ XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, clip);
+
+ XRenderComposite (xdisplay, PictOpOver, cw->picture,
+ cw->alpha_pict, root_buffer, 0, 0, 0, 0,
+ x, y, wid, hei);
+
+ if (clip)
+ XFixesDestroyRegion (xdisplay, clip);
+ }
+ else if (cw->mode == WINDOW_ARGB && cw->mask == None)
+ {
XRenderComposite (xdisplay, PictOpOver, cw->picture,
cw->alpha_pict, root_buffer, 0, 0, 0, 0,
x, y, wid, hei);