xgetshape
diff src/main.c @ 2:b832d3b3ed98
taking offset into account in get_window_shape
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 01 Feb 2016 12:18:29 +0200 |
parents | 9b560415bad4 |
children |
line diff
1.1 --- a/src/main.c Tue Nov 03 04:08:32 2015 +0200 1.2 +++ b/src/main.c Mon Feb 01 12:18:29 2016 +0200 1.3 @@ -333,20 +333,24 @@ 1.4 int bx, by, cx, cy; 1.5 unsigned int bw, bh, cw, ch; 1.6 int kind; 1.7 - int w, h; 1.8 + int xoffs, yoffs, w, h; 1.9 XRectangle *rects; 1.10 int i, rect_count, rect_order; 1.11 1.12 XShapeQueryExtents(dpy, win, &buse, &bx, &by, &bw, &bh, 1.13 &cuse, &cx, &cy, &cw, &ch); 1.14 - if(cuse) { 1.15 + if(buse) { 1.16 + w = bw; 1.17 + h = bh; 1.18 + xoffs = bx; 1.19 + yoffs = by; 1.20 + kind = ShapeBounding; 1.21 + } else if(cuse) { 1.22 w = cw; 1.23 h = ch; 1.24 + xoffs = cx; 1.25 + yoffs = cy; 1.26 kind = ShapeClip; 1.27 - } else if(buse) { 1.28 - w = bw; 1.29 - h = bh; 1.30 - kind = ShapeBounding; 1.31 } else { 1.32 fprintf(stderr, "XShapeQueryExtents returned no extents\n"); 1.33 return -1; 1.34 @@ -365,7 +369,7 @@ 1.35 } 1.36 1.37 for(i=0; i<rect_count; i++) { 1.38 - image_fillrect(img, rects[i].x, rects[i].y, rects[i].width, rects[i].height, 1.39 + image_fillrect(img, rects[i].x - xoffs, rects[i].y - yoffs, rects[i].width, rects[i].height, 1.40 255, 255, 255, 255); 1.41 } 1.42 return 0;