Commit ec1aac45 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Pixmap.c: scope improvements

parent 6c44480d
...@@ -99,11 +99,6 @@ struct nxagentPixmapPair ...@@ -99,11 +99,6 @@ struct nxagentPixmapPair
PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
int depth, unsigned usage_hint) int depth, unsigned usage_hint)
{ {
nxagentPrivPixmapPtr pPixmapPriv, pVirtualPriv;
PixmapPtr pPixmap;
PixmapPtr pVirtual;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentCreatePixmap: Creating pixmap with width [%d] " fprintf(stderr, "nxagentCreatePixmap: Creating pixmap with width [%d] "
"height [%d] depth [%d] and allocation hint [%d].\n", "height [%d] depth [%d] and allocation hint [%d].\n",
...@@ -115,7 +110,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -115,7 +110,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* not allocate memory for the data. * not allocate memory for the data.
*/ */
pPixmap = AllocatePixmap(pScreen, 0); PixmapPtr pPixmap = AllocatePixmap(pScreen, 0);
if (!pPixmap) if (!pPixmap)
{ {
...@@ -152,7 +147,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -152,7 +147,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* Initialize the privates of the real picture. * Initialize the privates of the real picture.
*/ */
pPixmapPriv = nxagentPixmapPriv(pPixmap); nxagentPrivPixmapPtr pPixmapPriv = nxagentPixmapPriv(pPixmap);
pPixmapPriv -> isVirtual = False; pPixmapPriv -> isVirtual = False;
pPixmapPriv -> isShared = nxagentShmPixmapTrap; pPixmapPriv -> isShared = nxagentShmPixmapTrap;
...@@ -164,12 +159,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -164,12 +159,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
if (pPixmapPriv -> isShared == 1) if (pPixmapPriv -> isShared == 1)
{ {
BoxRec box; BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height };
box.x1 = 0;
box.y1 = 0;
box.x2 = width;
box.y2 = height;
pPixmapPriv -> corruptedRegion = RegionCreate(&box, 1); pPixmapPriv -> corruptedRegion = RegionCreate(&box, 1);
} }
...@@ -245,7 +235,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -245,7 +235,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* Create the pixmap in the virtual framebuffer. * Create the pixmap in the virtual framebuffer.
*/ */
pVirtual = fbCreatePixmap(pScreen, width, height, depth, usage_hint); PixmapPtr pVirtual = fbCreatePixmap(pScreen, width, height, depth, usage_hint);
if (pVirtual == NULL) if (pVirtual == NULL)
{ {
...@@ -277,7 +267,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -277,7 +267,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* removed in future. * removed in future.
*/ */
pVirtualPriv = nxagentPixmapPriv(pVirtual); nxagentPrivPixmapPtr pVirtualPriv = nxagentPixmapPriv(pVirtual);
pVirtualPriv -> isVirtual = True; pVirtualPriv -> isVirtual = True;
pVirtualPriv -> isShared = nxagentShmPixmapTrap; pVirtualPriv -> isShared = nxagentShmPixmapTrap;
...@@ -332,10 +322,6 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, ...@@ -332,10 +322,6 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
Bool nxagentDestroyPixmap(PixmapPtr pPixmap) Bool nxagentDestroyPixmap(PixmapPtr pPixmap)
{ {
PixmapPtr pVirtual;
nxagentPrivPixmapPtr pPixmapPriv;
if (!pPixmap) if (!pPixmap)
{ {
#ifdef PANIC #ifdef PANIC
...@@ -346,9 +332,9 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) ...@@ -346,9 +332,9 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap)
return False; return False;
} }
pPixmapPriv = nxagentPixmapPriv(pPixmap); nxagentPrivPixmapPtr pPixmapPriv = nxagentPixmapPriv(pPixmap);
pVirtual = pPixmapPriv -> pVirtualPixmap; PixmapPtr pVirtual = pPixmapPriv -> pVirtualPixmap;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentDestroyPixmap: Destroying pixmap at [%p] with virtual at [%p].\n", fprintf(stderr, "nxagentDestroyPixmap: Destroying pixmap at [%p] with virtual at [%p].\n",
...@@ -357,8 +343,6 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) ...@@ -357,8 +343,6 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap)
if (pPixmapPriv -> isVirtual) if (pPixmapPriv -> isVirtual)
{ {
int refcnt;
/* /*
* For some pixmaps we receive the destroy only for the * For some pixmaps we receive the destroy only for the
* virtual. Infact to draw in the framebuffer we can use * virtual. Infact to draw in the framebuffer we can use
...@@ -375,11 +359,11 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) ...@@ -375,11 +359,11 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap)
pPixmapPriv = nxagentPixmapPriv(pPixmap); pPixmapPriv = nxagentPixmapPriv(pPixmap);
/* /*
* Move the references accumulated by the virtual * Move the references accumulated by the virtual pixmap into the
* pixmap into the references of the real one. * references of the real one.
*/ */
refcnt = pVirtual -> refcnt - 1; int refcnt = pVirtual -> refcnt - 1;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentDestroyPixmap: Adding [%d] references to pixmap at [%p].\n", fprintf(stderr, "nxagentDestroyPixmap: Adding [%d] references to pixmap at [%p].\n",
...@@ -473,10 +457,7 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) ...@@ -473,10 +457,7 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap)
Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap) Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap)
{ {
PixmapPtr pVirtual; PixmapPtr pVirtual = nxagentPixmapPriv(pPixmap) -> pVirtualPixmap;
nxagentPrivPixmapPtr pVirtualPriv;
pVirtual = nxagentPixmapPriv(pPixmap) -> pVirtualPixmap;
/* /*
* Force the routine to get rid of the virtual * Force the routine to get rid of the virtual
...@@ -487,7 +468,7 @@ Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap) ...@@ -487,7 +468,7 @@ Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap)
{ {
pVirtual -> refcnt = 1; pVirtual -> refcnt = 1;
pVirtualPriv = nxagentPixmapPriv(pVirtual); nxagentPrivPixmapPtr pVirtualPriv = nxagentPixmapPriv(pVirtual);
if (pVirtualPriv -> corruptedRegion != NullRegion) if (pVirtualPriv -> corruptedRegion != NullRegion)
{ {
...@@ -515,8 +496,6 @@ RegionPtr nxagentPixmapToRegion(PixmapPtr pPixmap) ...@@ -515,8 +496,6 @@ RegionPtr nxagentPixmapToRegion(PixmapPtr pPixmap)
Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, void * pPixData) int bitsPerPixel, int devKind, void * pPixData)
{ {
PixmapPtr pVirtualPixmap;
/* /*
* See miModifyPixmapHeader() in miscrinit.c. This * See miModifyPixmapHeader() in miscrinit.c. This
* function is used to recycle the scratch pixmap * function is used to recycle the scratch pixmap
...@@ -539,7 +518,7 @@ Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int dep ...@@ -539,7 +518,7 @@ Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int dep
FatalError("nxagentModifyPixmapHeader: PANIC! Pixmap is virtual."); FatalError("nxagentModifyPixmapHeader: PANIC! Pixmap is virtual.");
} }
pVirtualPixmap = nxagentVirtualPixmap(pPixmap); PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentModifyPixmapHeader: Pixmap at [%p] Virtual at [%p].\n", fprintf(stderr, "nxagentModifyPixmapHeader: Pixmap at [%p] Virtual at [%p].\n",
...@@ -593,15 +572,15 @@ static void nxagentPixmapMatchID(void *p0, XID x1, void *p2) ...@@ -593,15 +572,15 @@ static void nxagentPixmapMatchID(void *p0, XID x1, void *p2)
PixmapPtr nxagentPixmapPtr(Pixmap pixmap) PixmapPtr nxagentPixmapPtr(Pixmap pixmap)
{ {
struct nxagentPixmapPair pair;
if (pixmap == None) if (pixmap == None)
{ {
return NULL; return NULL;
} }
pair.pixmap = pixmap; struct nxagentPixmapPair pair = {
pair.pMap = NULL; .pixmap = pixmap,
.pMap = NULL
};
FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP,
nxagentPixmapMatchID, &pair); nxagentPixmapMatchID, &pair);
...@@ -659,9 +638,7 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2) ...@@ -659,9 +638,7 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2)
PixmapPtr pPixmap = (PixmapPtr) p0; PixmapPtr pPixmap = (PixmapPtr) p0;
#ifdef TEST #ifdef TEST
Bool *pBool; Bool *pBool = (Bool*) p2;
pBool = (Bool*) p2;
fprintf(stderr, "nxagentDisconnectPixmap: Called with bool [%d] and pixmap at [%p].\n", fprintf(stderr, "nxagentDisconnectPixmap: Called with bool [%d] and pixmap at [%p].\n",
*pBool, (void *) pPixmap); *pBool, (void *) pPixmap);
...@@ -682,7 +659,6 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2) ...@@ -682,7 +659,6 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2)
Bool nxagentDisconnectAllPixmaps(void) Bool nxagentDisconnectAllPixmaps(void)
{ {
int i;
int r = 1; int r = 1;
#ifdef TEST #ifdef TEST
...@@ -708,7 +684,7 @@ Bool nxagentDisconnectAllPixmaps(void) ...@@ -708,7 +684,7 @@ Bool nxagentDisconnectAllPixmaps(void)
#endif #endif
for (i = 0, r = 1; i < MAXCLIENTS; r = 1, i++) for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++)
{ {
if (clients[i]) if (clients[i])
{ {
...@@ -742,7 +718,6 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2) ...@@ -742,7 +718,6 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2)
{ {
PixmapPtr pPixmap = (PixmapPtr) p0; PixmapPtr pPixmap = (PixmapPtr) p0;
Bool *pBool = (Bool*) p2; Bool *pBool = (Bool*) p2;
nxagentPrivPixmapPtr pPixmapPriv;
if (!*pBool || pPixmap == NULL || if (!*pBool || pPixmap == NULL ||
NXDisplayError(nxagentDisplay) == 1) NXDisplayError(nxagentDisplay) == 1)
...@@ -781,7 +756,7 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2) ...@@ -781,7 +756,7 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2)
(void *) nxagentPixmapPriv(pPixmap) -> pPicture); (void *) nxagentPixmapPriv(pPixmap) -> pPicture);
#endif #endif
pPixmapPriv = nxagentPixmapPriv(pPixmap); nxagentPrivPixmapPtr pPixmapPriv = nxagentPixmapPriv(pPixmap);
if (pPixmap -> drawable.width && pPixmap -> drawable.height) if (pPixmap -> drawable.width && pPixmap -> drawable.height)
{ {
...@@ -948,30 +923,26 @@ static void nxagentCheckOnePixmapIntegrity(void *p0, XID x1, void *p2) ...@@ -948,30 +923,26 @@ static void nxagentCheckOnePixmapIntegrity(void *p0, XID x1, void *p2)
Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap) Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
{ {
Bool integrity = True; Bool integrity = True;
XImage *image;
char *data;
int format;
unsigned long plane_mask = AllPlanes; unsigned long plane_mask = AllPlanes;
unsigned int width, height, length, depth;
PixmapPtr pVirtual = nxagentVirtualPixmap(pPixmap); PixmapPtr pVirtual = nxagentVirtualPixmap(pPixmap);
width = pPixmap -> drawable.width; unsigned int width = pPixmap -> drawable.width;
height = pPixmap -> drawable.height; unsigned int height = pPixmap -> drawable.height;
depth = pPixmap -> drawable.depth; unsigned int depth = pPixmap -> drawable.depth;
format = (depth == 1) ? XYPixmap : ZPixmap; int format = (depth == 1) ? XYPixmap : ZPixmap;
if (width && height) if (width && height)
{ {
length = nxagentImageLength(width, height, format, 0, depth); unsigned int length = nxagentImageLength(width, height, format, 0, depth);
data = malloc(length); char *data = malloc(length);
if (data == NULL) if (data == NULL)
{ {
FatalError("nxagentCheckPixmapIntegrity: Failed to allocate a buffer of size %d.\n", length); FatalError("nxagentCheckPixmapIntegrity: Failed to allocate a buffer of size %d.\n", length);
} }
image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), 0, 0, XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), 0, 0,
width, height, plane_mask, format); width, height, plane_mask, format);
if (image == NULL) if (image == NULL)
{ {
...@@ -1019,10 +990,10 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap) ...@@ -1019,10 +990,10 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
if (!integrity) if (!integrity)
{ {
char *p = image -> data;
char *q = data;
char *p, *q; for (int i = 0; i < length; i++)
for (int i = 0, p = image -> data, q = data; i < length; i++)
{ {
if (p[i] != q[i]) if (p[i] != q[i])
{ {
...@@ -1099,14 +1070,6 @@ Bool nxagentCheckAllPixmapIntegrity(void) ...@@ -1099,14 +1070,6 @@ Bool nxagentCheckAllPixmapIntegrity(void)
void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
int wPict, int hPict) int wPict, int hPict)
{ {
GCPtr pGC;
char *data;
int width, height;
int depth, length, format;
CARD32 attributes[3];
int saveTrap;
if (pDrawable -> type == DRAWABLE_PIXMAP && if (pDrawable -> type == DRAWABLE_PIXMAP &&
nxagentIsShmPixmap((PixmapPtr) pDrawable) == 1) nxagentIsShmPixmap((PixmapPtr) pDrawable) == 1)
{ {
...@@ -1115,7 +1078,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, ...@@ -1115,7 +1078,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
(void *) pDrawable); (void *) pDrawable);
#endif #endif
pGC = nxagentGetScratchGC(pDrawable -> depth, pDrawable -> pScreen); GCPtr pGC = nxagentGetScratchGC(pDrawable -> depth, pDrawable -> pScreen);
CARD32 attributes[3];
attributes[0] = 0x228b22; attributes[0] = 0x228b22;
attributes[1] = 0xffffff; attributes[1] = 0xffffff;
...@@ -1125,16 +1090,16 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, ...@@ -1125,16 +1090,16 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
ValidateGC(pDrawable, pGC); ValidateGC(pDrawable, pGC);
width = (wPict != 0 && wPict <= pDrawable -> width) ? wPict : pDrawable -> width; int width = (wPict != 0 && wPict <= pDrawable -> width) ? wPict : pDrawable -> width;
height = (hPict != 0 && hPict <= pDrawable -> height) ? hPict : pDrawable -> height; int height = (hPict != 0 && hPict <= pDrawable -> height) ? hPict : pDrawable -> height;
depth = pDrawable -> depth; int depth = pDrawable -> depth;
format = (depth == 1) ? XYPixmap : ZPixmap; int format = (depth == 1) ? XYPixmap : ZPixmap;
length = nxagentImageLength(width, height, format, 0, depth); int length = nxagentImageLength(width, height, format, 0, depth);
saveTrap = nxagentGCTrap; int saveTrap = nxagentGCTrap;
nxagentGCTrap = 0; nxagentGCTrap = 0;
...@@ -1142,7 +1107,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, ...@@ -1142,7 +1107,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
nxagentFBTrap = 1; nxagentFBTrap = 1;
if ((data = malloc(length)) != NULL) char *data = malloc(length);
if (data)
{ {
fbGetImage(nxagentVirtualDrawable(pDrawable), xPict, yPict, fbGetImage(nxagentVirtualDrawable(pDrawable), xPict, yPict,
width, height, format, 0xffffffff, data); width, height, format, 0xffffffff, data);
...@@ -1190,13 +1157,6 @@ Bool nxagentPixmapOnShadowDisplay(PixmapPtr pMap) ...@@ -1190,13 +1157,6 @@ Bool nxagentPixmapOnShadowDisplay(PixmapPtr pMap)
static int length; static int length;
static unsigned int format; static unsigned int format;
XlibGC gc;
XGCValues value;
XImage *image;
Visual *pVisual;
char *data = NULL;
if (init) if (init)
{ {
if (pMap == NULL) if (pMap == NULL)
...@@ -1264,7 +1224,9 @@ FIXME: If the pixmap has a different depth from the window, the ...@@ -1264,7 +1224,9 @@ FIXME: If the pixmap has a different depth from the window, the
length = nxagentImageLength(width, height, format, 0, depth); length = nxagentImageLength(width, height, format, 0, depth);
if ((data = malloc(length)) == NULL) char * data = malloc(length);
if (data == NULL)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentPixmapOnShadowDisplay: WARNING! Failed to allocate memory for the operation.\n"); fprintf(stderr, "nxagentPixmapOnShadowDisplay: WARNING! Failed to allocate memory for the operation.\n");
...@@ -1276,7 +1238,7 @@ FIXME: If the pixmap has a different depth from the window, the ...@@ -1276,7 +1238,7 @@ FIXME: If the pixmap has a different depth from the window, the
fbGetImage((DrawablePtr) nxagentVirtualPixmap(pPixmap), 0, 0, fbGetImage((DrawablePtr) nxagentVirtualPixmap(pPixmap), 0, 0,
width, height, format, AllPlanes, data); width, height, format, AllPlanes, data);
pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth); Visual *pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth);
if (pVisual == NULL) if (pVisual == NULL)
{ {
...@@ -1287,10 +1249,10 @@ FIXME: If the pixmap has a different depth from the window, the ...@@ -1287,10 +1249,10 @@ FIXME: If the pixmap has a different depth from the window, the
pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual;
} }
image = XCreateImage(nxagentDisplay, pVisual, XImage *image = XCreateImage(nxagentDisplay, pVisual,
depth, format, 0, (char *) data, depth, format, 0, (char *) data,
width, height, BitmapPad(nxagentDisplay), width, height, BitmapPad(nxagentDisplay),
nxagentImagePad(width, format, 0, depth)); nxagentImagePad(width, format, 0, depth));
if (image == NULL) if (image == NULL)
{ {
...@@ -1303,13 +1265,15 @@ FIXME: If the pixmap has a different depth from the window, the ...@@ -1303,13 +1265,15 @@ FIXME: If the pixmap has a different depth from the window, the
return False; return False;
} }
value.foreground = 0xff0000; XGCValues value = {
value.background = 0x000000; .foreground = 0xff0000,
value.plane_mask = 0xffffff; .background = 0x000000,
value.fill_style = FillSolid; .plane_mask = 0xffffff,
.fill_style = FillSolid
};
gc = XCreateGC(shadow, win, GCBackground | XlibGC gc = XCreateGC(shadow, win, GCBackground |
GCForeground | GCFillStyle | GCPlaneMask, &value); GCForeground | GCFillStyle | GCPlaneMask, &value);
NXCleanImage(image); NXCleanImage(image);
...@@ -1333,15 +1297,7 @@ Bool nxagentFbOnShadowDisplay(void) ...@@ -1333,15 +1297,7 @@ Bool nxagentFbOnShadowDisplay(void)
static int showTime; static int showTime;
static int prevWidth, prevHeight; static int prevWidth, prevHeight;
XlibGC gc;
XGCValues value;
XImage *image;
Visual *pVisual;
WindowPtr pWin = screenInfo.screens[0]->root; WindowPtr pWin = screenInfo.screens[0]->root;
unsigned int format;
int depth, width, height, length;
char *data = NULL;
if (pWin == NULL) if (pWin == NULL)
{ {
...@@ -1352,10 +1308,10 @@ Bool nxagentFbOnShadowDisplay(void) ...@@ -1352,10 +1308,10 @@ Bool nxagentFbOnShadowDisplay(void)
return False; return False;
} }
depth = pWin -> drawable.depth; int depth = pWin -> drawable.depth;
width = pWin -> drawable.width; int width = pWin -> drawable.width;
height = pWin -> drawable.height; int height = pWin -> drawable.height;
format = (depth == 1) ? XYPixmap : ZPixmap; unsigned int format = (depth == 1) ? XYPixmap : ZPixmap;
if (init) if (init)
{ {
...@@ -1411,19 +1367,22 @@ Bool nxagentFbOnShadowDisplay(void) ...@@ -1411,19 +1367,22 @@ Bool nxagentFbOnShadowDisplay(void)
if (prevWidth != width || prevHeight != height) if (prevWidth != width || prevHeight != height)
{ {
XWindowChanges values;
prevWidth = width; prevWidth = width;
prevHeight = height; prevHeight = height;
values.width = width; XWindowChanges values = {
values.height = height; .width = width,
.height = height
};
XConfigureWindow(shadow, win, CWWidth | CWHeight, &values); XConfigureWindow(shadow, win, CWWidth | CWHeight, &values);
} }
length = nxagentImageLength(width, height, format, 0, depth); int length = nxagentImageLength(width, height, format, 0, depth);
if ((data = malloc(length)) == NULL) char *data = malloc(length);
if (data == NULL)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentFbOnShadowDisplay: WARNING! Failed to allocate memory for the operation.\n"); fprintf(stderr, "nxagentFbOnShadowDisplay: WARNING! Failed to allocate memory for the operation.\n");
...@@ -1435,7 +1394,7 @@ Bool nxagentFbOnShadowDisplay(void) ...@@ -1435,7 +1394,7 @@ Bool nxagentFbOnShadowDisplay(void)
fbGetImage((DrawablePtr)pWin, 0, 0, fbGetImage((DrawablePtr)pWin, 0, 0,
width, height, format, AllPlanes, data); width, height, format, AllPlanes, data);
pVisual = nxagentImageVisual((DrawablePtr) pWin, depth); Visual *pVisual = nxagentImageVisual((DrawablePtr) pWin, depth);
if (pVisual == NULL) if (pVisual == NULL)
{ {
...@@ -1446,10 +1405,10 @@ Bool nxagentFbOnShadowDisplay(void) ...@@ -1446,10 +1405,10 @@ Bool nxagentFbOnShadowDisplay(void)
pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual;
} }
image = XCreateImage(nxagentDisplay, pVisual, XImage *image = XCreateImage(nxagentDisplay, pVisual,
depth, format, 0, (char *) data, depth, format, 0, (char *) data,
width, height, BitmapPad(nxagentDisplay), width, height, BitmapPad(nxagentDisplay),
nxagentImagePad(width, format, 0, depth)); nxagentImagePad(width, format, 0, depth));
if (image == NULL) if (image == NULL)
{ {
...@@ -1462,13 +1421,15 @@ Bool nxagentFbOnShadowDisplay(void) ...@@ -1462,13 +1421,15 @@ Bool nxagentFbOnShadowDisplay(void)
return False; return False;
} }
value.foreground = 0xff0000; XGCValues value = {
value.background = 0x000000; .foreground = 0xff0000,
value.plane_mask = 0xffffff; .background = 0x000000,
value.fill_style = FillSolid; .plane_mask = 0xffffff,
.fill_style = FillSolid
};
gc = XCreateGC(shadow, win, GCBackground | XlibGC gc = XCreateGC(shadow, win, GCBackground |
GCForeground | GCFillStyle | GCPlaneMask, &value); GCForeground | GCFillStyle | GCPlaneMask, &value);
NXCleanImage(image); NXCleanImage(image);
...@@ -1509,14 +1470,14 @@ void nxagentPrintResourcePredicate(void *value, XID id, XID type, void *cdata) ...@@ -1509,14 +1470,14 @@ void nxagentPrintResourcePredicate(void *value, XID id, XID type, void *cdata)
void nxagentPrintResources(void) void nxagentPrintResources(void)
{ {
Bool result;
nxagentPrintResourceTypes(); nxagentPrintResourceTypes();
for (int i = 0; i < MAXCLIENTS; i++) for (int i = 0; i < MAXCLIENTS; i++)
{ {
if (clients[i]) if (clients[i])
{ {
Bool result;
fprintf(stderr, "nxagentPrintResources: Printing resources for client [%d]:\n", fprintf(stderr, "nxagentPrintResources: Printing resources for client [%d]:\n",
i); i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment