summaryrefslogtreecommitdiff
path: root/miext/rootless/rootlessGC.c
diff options
context:
space:
mode:
Diffstat (limited to 'miext/rootless/rootlessGC.c')
-rw-r--r--miext/rootless/rootlessGC.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index b26f52c54..c80b11f1d 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -276,11 +276,11 @@ RootlessCreateGC(GCPtr pGC)
Bool result;
SCREEN_UNWRAP(pGC->pScreen, CreateGC);
- s = (RootlessScreenRec *) pGC->pScreen->
- devPrivates[rootlessScreenPrivateIndex].ptr;
+ s = SCREENREC(pGC->pScreen);
result = s->CreateGC(pGC);
- gcrec = (RootlessGCRec *) pGC->devPrivates[rootlessGCPrivateIndex].ptr;
+ gcrec = (RootlessGCRec *)
+ dixLookupPrivate(&pGC->devPrivates, rootlessGCPrivateKey);
gcrec->originalOps = NULL; // don't wrap ops yet
gcrec->originalFuncs = pGC->funcs;
pGC->funcs = &rootlessGCFuncs;
@@ -302,7 +302,7 @@ RootlessCreateGC(GCPtr pGC)
// does not assume ops have been wrapped
#define GCFUNC_UNWRAP(pGC) \
RootlessGCRec *gcrec = (RootlessGCRec *) \
- (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \
+ dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
(pGC)->funcs = gcrec->originalFuncs; \
if (gcrec->originalOps) { \
(pGC)->ops = gcrec->originalOps; \
@@ -399,7 +399,7 @@ static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
// assumes both funcs and ops are wrapped
#define GCOP_UNWRAP(pGC) \
RootlessGCRec *gcrec = (RootlessGCRec *) \
- (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \
+ dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
GCFuncs *saveFuncs = pGC->funcs; \
(pGC)->funcs = gcrec->originalFuncs; \
(pGC)->ops = gcrec->originalOps;
@@ -413,10 +413,12 @@ static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
#define GC_IS_ROOT(pDst) ((pDst)->type == DRAWABLE_WINDOW \
&& IsRoot ((WindowPtr) (pDst)))
-#define GC_SKIP_ROOT(pDst) \
+#define GC_SKIP_ROOT(pDst, pGC) \
do { \
- if (GC_IS_ROOT (pDst)) \
+ if (GC_IS_ROOT (pDst)) { \
+ GCOP_WRAP(pGC); \
return; \
+ } \
} while (0)
@@ -426,7 +428,7 @@ RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill spans start ");
if (nInit <= 0) {
@@ -482,7 +484,7 @@ RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
int nspans, int sorted)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("set spans start ");
if (nspans <= 0) {
@@ -533,7 +535,7 @@ RootlessPutImage(DrawablePtr dst, GCPtr pGC,
BoxRec box;
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("put image start ");
RootlessStartDrawing((WindowPtr) dst);
@@ -565,7 +567,10 @@ RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst) || GC_IS_ROOT(pSrc))
+ {
+ GCOP_WRAP(pGC);
return NULL; /* nothing exposed */
+ }
RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
@@ -615,7 +620,10 @@ static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst) || GC_IS_ROOT(pSrc))
+ {
+ GCOP_WRAP(pGC);
return NULL; /* nothing exposed */
+ }
RL_DEBUG_MSG("copy plane start ");
@@ -652,7 +660,7 @@ static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC,
int mode, int npt, DDXPointPtr pptInit)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("polypoint start ");
RootlessStartDrawing((WindowPtr) dst);
@@ -746,7 +754,7 @@ static void RootlessPolylines(DrawablePtr dst, GCPtr pGC,
int mode, int npt, DDXPointPtr pptInit)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly lines start ");
RootlessStartDrawing((WindowPtr) dst);
@@ -821,7 +829,7 @@ static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC,
int nseg, xSegment *pSeg)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly segment start (win 0x%x)", dst);
RootlessStartDrawing((WindowPtr) dst);
@@ -892,7 +900,7 @@ static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
int nRects, xRectangle *pRects)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly rectangle start ");
RootlessStartDrawing((WindowPtr) dst);
@@ -953,7 +961,7 @@ static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC,
static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("poly arc start ");
RootlessStartDrawing((WindowPtr) dst);
@@ -1009,7 +1017,7 @@ static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill poly start (win 0x%x, fillStyle 0x%x)", dst,
pGC->fillStyle);
@@ -1083,7 +1091,7 @@ static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill rect start (win 0x%x, fillStyle 0x%x)", dst,
pGC->fillStyle);
@@ -1138,7 +1146,7 @@ static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("fill arc start ");
if (narcsInit > 0) {
@@ -1193,7 +1201,7 @@ static void RootlessImageText8(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("imagetext8 start ");
if (count > 0) {
@@ -1247,7 +1255,10 @@ static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst))
+ {
+ GCOP_WRAP(pGC);
return 0;
+ }
RL_DEBUG_MSG("polytext8 start ");
@@ -1285,7 +1296,7 @@ static void RootlessImageText16(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("imagetext16 start ");
if (count > 0) {
@@ -1339,7 +1350,10 @@ static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC,
GCOP_UNWRAP(pGC);
if (GC_IS_ROOT(dst))
+ {
+ GCOP_WRAP(pGC);
return 0;
+ }
RL_DEBUG_MSG("polytext16 start ");
@@ -1378,7 +1392,7 @@ static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("imageglyph start ");
if (nglyphInit > 0) {
@@ -1439,7 +1453,7 @@ static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
CharInfoPtr *ppci, pointer pglyphBase)
{
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("polyglyph start ");
RootlessStartDrawing((WindowPtr) dst);
@@ -1485,7 +1499,7 @@ RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
BoxRec box;
GCOP_UNWRAP(pGC);
- GC_SKIP_ROOT(dst);
+ GC_SKIP_ROOT(dst, pGC);
RL_DEBUG_MSG("push pixels start ");
RootlessStartDrawing((WindowPtr) dst);