[X2Go-Commits] [nx-libs] 54/219: NXmiexpose.c: use upstream version of miPaintWindows()

git-admin at x2go.org git-admin at x2go.org
Sat Sep 28 12:10:20 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 9e051eab0fee0915702c6752669542c7cc40de18
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Wed May 1 01:22:39 2019 +0200

    NXmiexpose.c: use upstream version of miPaintWindows()
    
    miPaintWindow() was identical to the version in miexpose.c except
    for some unitialized variable fixes. As these also should be in
    upstream code we add them there (Note: Xorg never fixed this but
    totally rewrote the miPaintWindow() later on.)
    
    This allows us to totally drop our special version of miPaintWindow().
---
 nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c | 269 ------------------------
 nx-X11/programs/Xserver/mi/miexpose.c           |   6 +-
 2 files changed, 2 insertions(+), 273 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c
index ff331ecc2..085684fc1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c
@@ -202,272 +202,3 @@ miWindowExposures(pWin, prgn, other_exposed)
     else if (exposures && exposures != prgn)
 	RegionDestroy(exposures);
 }
-
-void
-miPaintWindow(pWin, prgn, what)
-register WindowPtr pWin;
-RegionPtr prgn;
-int what;
-{
-    int	status;
-
-    Bool usingScratchGC = FALSE;
-    WindowPtr pRoot;
-	
-#define FUNCTION	0
-#define FOREGROUND	1
-#define TILE		2
-#define FILLSTYLE	3
-#define ABSX		4
-#define ABSY		5
-#define CLIPMASK	6
-#define SUBWINDOW	7
-#define COUNT_BITS	8
-
-    ChangeGCVal gcval[7];
-    ChangeGCVal newValues [COUNT_BITS] = {{ 0 }};
-
-    BITS32 gcmask, index, mask;
-    RegionRec prgnWin;
-    DDXPointRec oldCorner;
-    BoxRec box = {0};
-    WindowPtr	pBgWin;
-    GCPtr pGC;
-    register int i;
-    register BoxPtr pbox;
-    register ScreenPtr pScreen = pWin->drawable.pScreen;
-    register xRectangle *prect;
-    int numRects;
-
-    /*
-     * Set the elements reported by the compiler
-     * as uninitialized.
-     */
-
-    prgnWin.extents.x1 = 0;
-    prgnWin.extents.y1 = 0;
-    prgnWin.extents.x2 = 0;
-    prgnWin.extents.y2 = 0;
-
-    prgnWin.data = NULL;
-
-    oldCorner.x = 0;
-    oldCorner.y = 0;
-
-    gcmask = 0;
-
-    if (what == PW_BACKGROUND)
-    {
-	switch (pWin->backgroundState) {
-	case None:
-	    return;
-	case ParentRelative:
-	    (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what);
-	    return;
-	case BackgroundPixel:
-	    newValues[FOREGROUND].val = pWin->background.pixel;
-	    newValues[FILLSTYLE].val  = FillSolid;
-	    gcmask |= GCForeground | GCFillStyle;
-	    break;
-	case BackgroundPixmap:
-	    newValues[TILE].ptr = (void *)pWin->background.pixmap;
-	    newValues[FILLSTYLE].val = FillTiled;
-	    gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
-	    break;
-	}
-    }
-    else
-    {
-	if (pWin->borderIsPixel)
-	{
-	    newValues[FOREGROUND].val = pWin->border.pixel;
-	    newValues[FILLSTYLE].val  = FillSolid;
-	    gcmask |= GCForeground | GCFillStyle;
-	}
-	else
-	{
-	    newValues[TILE].ptr = (void *)pWin->border.pixmap;
-	    newValues[FILLSTYLE].val = FillTiled;
-	    gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
-	}
-    }
-
-    prect = (xRectangle *)calloc(RegionNumRects(prgn), sizeof(xRectangle));
-    if (!prect)
-	return;
-
-    newValues[FUNCTION].val = GXcopy;
-    gcmask |= GCFunction | GCClipMask;
-
-    i = pScreen->myNum;
-    pRoot = screenInfo.screens[i]->root;
-
-    pBgWin = pWin;
-    if (what == PW_BORDER)
-    {
-	while (pBgWin->backgroundState == ParentRelative)
-	    pBgWin = pBgWin->parent;
-    }
-
-    if ((pWin->drawable.depth != pRoot->drawable.depth) ||
-	(pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel))
-    {
-	usingScratchGC = TRUE;
-	pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
-	if (!pGC)
-	{
-	    free(prect);
-	    return;
-	}
-	/*
-	 * mash the clip list so we can paint the border by
-	 * mangling the window in place, pretending it
-	 * spans the entire screen
-	 */
-	if (what == PW_BORDER)
-	{
-	    prgnWin = pWin->clipList;
-	    oldCorner.x = pWin->drawable.x;
-	    oldCorner.y = pWin->drawable.y;
-	    pWin->drawable.x = pWin->drawable.y = 0;
-	    box.x1 = 0;
-	    box.y1 = 0;
-	    box.x2 = pScreen->width;
-	    box.y2 = pScreen->height;
-	    RegionInit(&pWin->clipList, &box, 1);
-	    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-	    newValues[ABSX].val = pBgWin->drawable.x;
-	    newValues[ABSY].val = pBgWin->drawable.y;
-	}
-	else
-	{
-	    newValues[ABSX].val = 0;
-	    newValues[ABSY].val = 0;
-	}
-    } else {
-	/*
-	 * draw the background to the root window
-	 */
-	if (screenContext[i] == (GCPtr)NULL)
-	{
-	    if (!ResType && !(ResType = CreateNewResourceType(tossGC)))
-		return;
-	    screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0,
-					(XID *)NULL, &status);
-	    if (!screenContext[i]) {
-		free(prect);
-		return;
-	    }
-	    numGCs++;
-	    if (!AddResource(FakeClientID(0), ResType,
-			     (void *)screenContext[i]))
-	    {
-		free(prect);
-		return;
-	    }
-	}
-	pGC = screenContext[i];
-	newValues[SUBWINDOW].val = IncludeInferiors;
-	newValues[ABSX].val = pBgWin->drawable.x;
-	newValues[ABSY].val = pBgWin->drawable.y;
-	gcmask |= GCSubwindowMode;
-	pWin = pRoot;
-    }
-    
-    if (pWin->backStorage)
-	(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);
-
-    mask = gcmask;
-    gcmask = 0;
-    i = 0;
-    while (mask) {
-    	index = lowbit (mask);
-	mask &= ~index;
-	switch (index) {
-	case GCFunction:
-	    if (pGC->alu != newValues[FUNCTION].val) {
-		gcmask |= index;
-		gcval[i++].val = newValues[FUNCTION].val;
-	    }
-	    break;
-	case GCTileStipXOrigin:
-	    if ( pGC->patOrg.x != newValues[ABSX].val) {
-		gcmask |= index;
-		gcval[i++].val = newValues[ABSX].val;
-	    }
-	    break;
-	case GCTileStipYOrigin:
-	    if ( pGC->patOrg.y != newValues[ABSY].val) {
-		gcmask |= index;
-		gcval[i++].val = newValues[ABSY].val;
-	    }
-	    break;
-	case GCClipMask:
-	    if ( pGC->clientClipType != CT_NONE) {
-		gcmask |= index;
-		gcval[i++].val = CT_NONE;
-	    }
-	    break;
-	case GCSubwindowMode:
-	    if ( pGC->subWindowMode != newValues[SUBWINDOW].val) {
-		gcmask |= index;
-		gcval[i++].val = newValues[SUBWINDOW].val;
-	    }
-	    break;
-	case GCTile:
-	    if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr)
- 	    {
-		gcmask |= index;
-		gcval[i++].ptr = newValues[TILE].ptr;
-	    }
-	    break;
-	case GCFillStyle:
-	    if ( pGC->fillStyle != newValues[FILLSTYLE].val) {
-		gcmask |= index;
-		gcval[i++].val = newValues[FILLSTYLE].val;
-	    }
-	    break;
-	case GCForeground:
-	    if ( pGC->fgPixel != newValues[FOREGROUND].val) {
-		gcmask |= index;
-		gcval[i++].val = newValues[FOREGROUND].val;
-	    }
-	    break;
-	}
-    }
-
-    if (gcmask)
-        dixChangeGC(NullClient, pGC, gcmask, NULL, gcval);
-
-    if (pWin->drawable.serialNumber != pGC->serialNumber)
-	ValidateGC((DrawablePtr)pWin, pGC);
-
-    numRects = RegionNumRects(prgn);
-    pbox = RegionRects(prgn);
-    for (i= numRects; --i >= 0; pbox++, prect++)
-    {
-	prect->x = pbox->x1 - pWin->drawable.x;
-	prect->y = pbox->y1 - pWin->drawable.y;
-	prect->width = pbox->x2 - pbox->x1;
-	prect->height = pbox->y2 - pbox->y1;
-    }
-    prect -= numRects;
-    (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
-    free(prect);
-
-    if (pWin->backStorage)
-	(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing);
-
-    if (usingScratchGC)
-    {
-	if (what == PW_BORDER)
-	{
-	    RegionUninit(&pWin->clipList);
-	    pWin->clipList = prgnWin;
-	    pWin->drawable.x = oldCorner.x;
-	    pWin->drawable.y = oldCorner.y;
-	    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-	}
-	FreeScratchGC(pGC);
-    }
-}
diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c
index 520b0ed7a..d2bf93c6c 100644
--- a/nx-X11/programs/Xserver/mi/miexpose.c
+++ b/nx-X11/programs/Xserver/mi/miexpose.c
@@ -626,7 +626,6 @@ tossGC (
     return 0;
 }
 
-#ifndef NXAGENT_SERVER
 void
 miPaintWindow(pWin, prgn, what)
 register WindowPtr pWin;
@@ -652,8 +651,8 @@ int what;
     ChangeGCVal newValues [COUNT_BITS] = {{ 0 }};
 
     BITS32 gcmask, index, mask;
-    RegionRec prgnWin;
-    DDXPointRec oldCorner;
+    RegionRec prgnWin = {0};
+    DDXPointRec oldCorner = {0};
     BoxRec box = {0};
     WindowPtr	pBgWin;
     GCPtr pGC;
@@ -881,7 +880,6 @@ int what;
 	FreeScratchGC(pGC);
     }
 }
-#endif
 
 /* MICLEARDRAWABLE -- sets the entire drawable to the background color of
  * the GC.  Useful when we have a scratch drawable and need to initialize 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list