Xnest: replace XSetClipRectangles() by xnset_set_clip_rectangles()
Use XCB for setting clip rectangles. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
3dda537e83
commit
9997ad9ab1
|
@ -201,10 +201,6 @@ xnestDestroyGC(GCPtr pGC)
|
||||||
void
|
void
|
||||||
xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
|
xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
BoxPtr pBox;
|
|
||||||
XRectangle *pRects;
|
|
||||||
|
|
||||||
xnestDestroyClip(pGC);
|
xnestDestroyClip(pGC);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -214,19 +210,32 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_REGION:
|
case CT_REGION:
|
||||||
nRects = RegionNumRects((RegionPtr) pValue);
|
{
|
||||||
if (!(pRects = calloc(nRects, sizeof(*pRects))))
|
nRects = RegionNumRects((RegionPtr) pValue);
|
||||||
break;
|
xcb_rectangle_t *rects= calloc(nRects, sizeof(xcb_rectangle_t));
|
||||||
pBox = RegionRects((RegionPtr) pValue);
|
if (rects == NULL) {
|
||||||
for (i = nRects; i-- > 0;) {
|
ErrorF("xnestChangeClip: memory alloc failure");
|
||||||
pRects[i].x = pBox[i].x1;
|
return;
|
||||||
pRects[i].y = pBox[i].y1;
|
}
|
||||||
pRects[i].width = pBox[i].x2 - pBox[i].x1;
|
BoxPtr pBox = RegionRects((RegionPtr) pValue);
|
||||||
pRects[i].height = pBox[i].y2 - pBox[i].y1;
|
for (int i = nRects; i-- > 0;)
|
||||||
|
rects[i] = (xcb_rectangle_t) {
|
||||||
|
.x = pBox[i].x1,
|
||||||
|
.y = pBox[i].y1,
|
||||||
|
.width = pBox[i].x2 - pBox[i].x1,
|
||||||
|
.height = pBox[i].y2 - pBox[i].y1,
|
||||||
|
};
|
||||||
|
xcb_set_clip_rectangles(
|
||||||
|
xnestUpstreamInfo.conn,
|
||||||
|
XCB_CLIP_ORDERING_UNSORTED,
|
||||||
|
xnest_upstream_gc(pGC),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
nRects,
|
||||||
|
rects);
|
||||||
|
|
||||||
|
free(rects);
|
||||||
}
|
}
|
||||||
XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
|
|
||||||
pRects, nRects, Unsorted);
|
|
||||||
free((char *) pRects);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_PIXMAP:
|
case CT_PIXMAP:
|
||||||
|
@ -242,27 +251,47 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_UNSORTED:
|
case CT_UNSORTED:
|
||||||
XSetClipRectangles(xnestDisplay, xnestGC(pGC),
|
xcb_set_clip_rectangles(
|
||||||
pGC->clipOrg.x, pGC->clipOrg.y,
|
xnestUpstreamInfo.conn,
|
||||||
(XRectangle *) pValue, nRects, Unsorted);
|
XCB_CLIP_ORDERING_UNSORTED,
|
||||||
|
xnest_upstream_gc(pGC),
|
||||||
|
pGC->clipOrg.x, pGC->clipOrg.y,
|
||||||
|
nRects,
|
||||||
|
(xcb_rectangle_t*)pValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_YSORTED:
|
case CT_YSORTED:
|
||||||
XSetClipRectangles(xnestDisplay, xnestGC(pGC),
|
xcb_set_clip_rectangles(
|
||||||
pGC->clipOrg.x, pGC->clipOrg.y,
|
xnestUpstreamInfo.conn,
|
||||||
(XRectangle *) pValue, nRects, YSorted);
|
XCB_CLIP_ORDERING_Y_SORTED,
|
||||||
|
xnest_upstream_gc(pGC),
|
||||||
|
pGC->clipOrg.x,
|
||||||
|
pGC->clipOrg.y,
|
||||||
|
nRects,
|
||||||
|
(xcb_rectangle_t*)pValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_YXSORTED:
|
case CT_YXSORTED:
|
||||||
XSetClipRectangles(xnestDisplay, xnestGC(pGC),
|
xcb_set_clip_rectangles(
|
||||||
pGC->clipOrg.x, pGC->clipOrg.y,
|
xnestUpstreamInfo.conn,
|
||||||
(XRectangle *) pValue, nRects, YXSorted);
|
XCB_CLIP_ORDERING_YX_SORTED,
|
||||||
|
xnest_upstream_gc(pGC),
|
||||||
|
pGC->clipOrg.x,
|
||||||
|
pGC->clipOrg.y,
|
||||||
|
nRects,
|
||||||
|
(xcb_rectangle_t*)pValue);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_YXBANDED:
|
case CT_YXBANDED:
|
||||||
XSetClipRectangles(xnestDisplay, xnestGC(pGC),
|
xcb_set_clip_rectangles(
|
||||||
pGC->clipOrg.x, pGC->clipOrg.y,
|
xnestUpstreamInfo.conn,
|
||||||
(XRectangle *) pValue, nRects, YXBanded);
|
XCB_CLIP_ORDERING_YX_BANDED,
|
||||||
|
xnest_upstream_gc(pGC),
|
||||||
|
pGC->clipOrg.x,
|
||||||
|
pGC->clipOrg.y,
|
||||||
|
nRects,
|
||||||
|
(xcb_rectangle_t*)pValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue