Xnest: make GC funcs static

These aren't used anywhere else, outside GC.c, just referenced in the func
vector struct, so no need to have them publicly visible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-05 10:50:01 +02:00
parent 889a25e4cc
commit b02a5ebc5e
2 changed files with 71 additions and 77 deletions

View File

@ -41,63 +41,12 @@ is" without express or implied warranty.
DevPrivateKeyRec xnestGCPrivateKeyRec;
static GCFuncs xnestFuncs = {
.ValidateGC = xnestValidateGC,
.ChangeGC = xnestChangeGC,
.CopyGC = xnestCopyGC,
.DestroyGC = xnestDestroyGC,
.ChangeClip = xnestChangeClip,
.DestroyClip = xnestDestroyClip,
.CopyClip = xnestCopyClip,
};
static GCOps xnestOps = {
.FillSpans = xnestFillSpans,
.SetSpans = xnestSetSpans,
.PutImage = xnestPutImage,
.CopyArea = xnestCopyArea,
.CopyPlane = xnestCopyPlane,
.PolyPoint = xnestPolyPoint,
.Polylines = xnestPolylines,
.PolySegment = xnestPolySegment,
.PolyRectangle = xnestPolyRectangle,
.PolyArc = xnestPolyArc,
.FillPolygon = xnestFillPolygon,
.PolyFillRect = xnestPolyFillRect,
.PolyFillArc = xnestPolyFillArc,
.PolyText8 = xnestPolyText8,
.PolyText16 = xnestPolyText16,
.ImageText8 = xnestImageText8,
.ImageText16 = xnestImageText16,
.ImageGlyphBlt = xnestImageGlyphBlt,
.PolyGlyphBlt = xnestPolyGlyphBlt,
.PushPixels = xnestPushPixels
};
Bool
xnestCreateGC(GCPtr pGC)
{
pGC->funcs = &xnestFuncs;
pGC->ops = &xnestOps;
pGC->miTranslate = 1;
xnestGCPriv(pGC)->gc = xcb_generate_id(xnestUpstreamInfo.conn);
xcb_create_gc(xnestUpstreamInfo.conn,
xnestGCPriv(pGC)->gc,
xnestDefaultDrawables[pGC->depth],
0,
NULL);
return TRUE;
}
void
static void
xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
}
void
static void
xnestChangeGC(GCPtr pGC, unsigned long mask)
{
xcb_params_gc_t values;
@ -188,7 +137,7 @@ xnestChangeGC(GCPtr pGC, unsigned long mask)
&values);
}
void
static void
xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
xcb_copy_gc(xnestUpstreamInfo.conn,
@ -197,13 +146,27 @@ xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
mask);
}
void
static void
xnestDestroyGC(GCPtr pGC)
{
xcb_free_gc(xnestUpstreamInfo.conn, xnestGC(pGC));
}
void
static void
xnestDestroyClip(GCPtr pGC)
{
if (pGC->clientClip) {
RegionDestroy(pGC->clientClip);
uint32_t val = XCB_PIXMAP_NONE;
xcb_change_gc(xnestUpstreamInfo.conn,
xnest_upstream_gc(pGC),
XCB_GC_CLIP_MASK,
&val);
pGC->clientClip = NULL;
}
}
static void
xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
{
xnestDestroyClip(pGC);
@ -329,21 +292,8 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
pGC->clientClip = pValue;
}
void
xnestDestroyClip(GCPtr pGC)
{
if (pGC->clientClip) {
RegionDestroy(pGC->clientClip);
uint32_t val = XCB_PIXMAP_NONE;
xcb_change_gc(xnestUpstreamInfo.conn,
xnest_upstream_gc(pGC),
XCB_GC_CLIP_MASK,
&val);
pGC->clientClip = NULL;
}
}
void
static void
xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
{
if (pGCSrc->clientClip) {
@ -354,3 +304,54 @@ xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
xnestDestroyClip(pGCDst);
}
}
static GCFuncs xnestFuncs = {
.ValidateGC = xnestValidateGC,
.ChangeGC = xnestChangeGC,
.CopyGC = xnestCopyGC,
.DestroyGC = xnestDestroyGC,
.ChangeClip = xnestChangeClip,
.DestroyClip = xnestDestroyClip,
.CopyClip = xnestCopyClip,
};
static GCOps xnestOps = {
.FillSpans = xnestFillSpans,
.SetSpans = xnestSetSpans,
.PutImage = xnestPutImage,
.CopyArea = xnestCopyArea,
.CopyPlane = xnestCopyPlane,
.PolyPoint = xnestPolyPoint,
.Polylines = xnestPolylines,
.PolySegment = xnestPolySegment,
.PolyRectangle = xnestPolyRectangle,
.PolyArc = xnestPolyArc,
.FillPolygon = xnestFillPolygon,
.PolyFillRect = xnestPolyFillRect,
.PolyFillArc = xnestPolyFillArc,
.PolyText8 = xnestPolyText8,
.PolyText16 = xnestPolyText16,
.ImageText8 = xnestImageText8,
.ImageText16 = xnestImageText16,
.ImageGlyphBlt = xnestImageGlyphBlt,
.PolyGlyphBlt = xnestPolyGlyphBlt,
.PushPixels = xnestPushPixels
};
Bool
xnestCreateGC(GCPtr pGC)
{
pGC->funcs = &xnestFuncs;
pGC->ops = &xnestOps;
pGC->miTranslate = 1;
xnestGCPriv(pGC)->gc = xcb_generate_id(xnestUpstreamInfo.conn);
xcb_create_gc(xnestUpstreamInfo.conn,
xnestGCPriv(pGC)->gc,
xnestDefaultDrawables[pGC->depth],
0,
NULL);
return TRUE;
}

View File

@ -34,12 +34,5 @@ extern DevPrivateKeyRec xnestGCPrivateKeyRec;
#define xnestGC(pGC) (xnestGCPriv(pGC)->gc)
Bool xnestCreateGC(GCPtr pGC);
void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
void xnestChangeGC(GCPtr pGC, unsigned long mask);
void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
void xnestDestroyGC(GCPtr pGC);
void xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects);
void xnestDestroyClip(GCPtr pGC);
void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
#endif /* XNESTGC_H */