(!1654) 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
							
								
									a1f0758f82
								
							
						
					
					
						commit
						bf93860c1f
					
				| 
						 | 
					@ -202,10 +202,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) {
 | 
				
			||||||
| 
						 | 
					@ -215,18 +211,32 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case CT_REGION:
 | 
					    case CT_REGION:
 | 
				
			||||||
        nRects = RegionNumRects((RegionPtr) pValue);
 | 
					        {
 | 
				
			||||||
        pRects = xallocarray(nRects, sizeof(*pRects));
 | 
					            nRects = RegionNumRects((RegionPtr) pValue);
 | 
				
			||||||
        pBox = RegionRects((RegionPtr) pValue);
 | 
					            xcb_rectangle_t *rects= calloc(nRects, sizeof(xcb_rectangle_t));
 | 
				
			||||||
        for (i = nRects; i-- > 0;) {
 | 
					            if (rects == NULL) {
 | 
				
			||||||
            pRects[i].x = pBox[i].x1;
 | 
					                ErrorF("xnestChangeClip: memory alloc failure");
 | 
				
			||||||
            pRects[i].y = pBox[i].y1;
 | 
					                return;
 | 
				
			||||||
            pRects[i].width = pBox[i].x2 - pBox[i].x1;
 | 
					            }
 | 
				
			||||||
            pRects[i].height = pBox[i].y2 - pBox[i].y1;
 | 
					            BoxPtr pBox = RegionRects((RegionPtr) pValue);
 | 
				
			||||||
 | 
					            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 +252,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