Seem to have ixed some Match errors, but introduced a very very strange segfault where XCBListColorReply() returns NULL, but the error is also NULL.

This commit is contained in:
Ori Bernstein 2006-06-15 00:49:30 -05:00 committed by Ori Bernstein
parent b1eb6817e4
commit 2a17338c61
5 changed files with 44 additions and 36 deletions

View file

@ -43,6 +43,7 @@ static ColormapPtr InstalledMaps[MAXSCREENS];
Bool xnestCreateColormap(ColormapPtr pCmap)
{
VisualPtr pVisual;
XCBGenericError *e;
XCBRGB *colors;
int i, ncolors;
CARD32 *pixels;
@ -115,10 +116,9 @@ Bool xnestCreateColormap(ColormapPtr pCmap)
blue += blueInc;
if (blue > pVisual->blueMask) blue = 0L;
}
c = XCBQueryColors(xnestConnection, xnestColormap(pCmap), ncolors, pixels);
xfree(pixels);
rep = XCBQueryColorsReply(xnestConnection, c, 0);
rep = XCBQueryColorsReply(xnestConnection, c, &e);
colors = XCBQueryColorsColors(rep);
for (i = 0; i < ncolors; i++) {
pCmap->red[i].co.local.red = colors[i].red;

View file

@ -43,12 +43,13 @@
Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
XCBPIXMAP source, mask;
XCBDRAWABLE d;
int pad;
int size;
XCBCURSOR c;
unsigned long valuemask;
XCBParamsGC values;
#if 0
valuemask = XCBGCFunction |
XCBGCPlaneMask |
XCBGCForeground |
@ -66,26 +67,28 @@ Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
source = XCBPIXMAPNew(xnestConnection);
mask = XCBPIXMAPNew(xnestConnection);
d.window = xnestDefaultWindows[pScreen->myNum];
XCBCreatePixmap(xnestConnection,
xnestDefaultDepth,
source,
(XCBDRAWABLE)xnestDefaultWindows[pScreen->myNum],
d,
pCursor->bits->width,
pCursor->bits->height);
XCBCreatePixmap(xnestConnection,
xnestDefaultDepth,
mask,
(XCBDRAWABLE) xnestDefaultWindows[pScreen->myNum],
d,
pCursor->bits->width,
pCursor->bits->height);
pad = XCBGetSetup(xnestConnection)->bitmap_format_scanline_pad;
/*not sure if this is right*/
size = (((pCursor->bits->width + pad - 1) & -pad) >> 3) * pCursor->bits->height;
d.pixmap = source;
XCBPutImage(xnestConnection,
XCBImageFormatXYBitmap,
(XCBDRAWABLE)source,
XCBImageFormatZPixmap,
d,
xnestBitmapGC,
pCursor->bits->width,
pCursor->bits->height,
@ -94,9 +97,10 @@ Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
1, /*depth*/
size, /*length..correct??*/
pCursor->bits->source); /*bits*/
d.pixmap = mask;
XCBPutImage(xnestConnection,
XCBImageFormatXYBitmap,
(XCBDRAWABLE)mask,
XCBImageFormatZPixmap,
d,
xnestBitmapGC,
pCursor->bits->width,
pCursor->bits->height,
@ -105,8 +109,9 @@ Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
1, /*depth*/
size, /*length..correct??*/
pCursor->bits->mask); /*bits*/
#endif
pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
#if 0
c = XCBCURSORNew(xnestConnection);
xnestCursorPriv(pCursor, pScreen)->cursor = c.xid;
XCBCreateCursor(xnestConnection,
@ -124,7 +129,7 @@ Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
XCBFreePixmap(xnestConnection, source);
XCBFreePixmap(xnestConnection, mask);
#endif
return True;
}

View file

@ -62,25 +62,25 @@ static XCBVISUALTYPE **xnestListVisuals(XCBConnection *c, CARD8 **depths, int *n
XCBVISUALTYPEIter viter;
XCBDEPTHIter diter;
XCBSCREEN *screen;
XCBVISUALTYPE **vis = NULL;
static XCBVISUALTYPE **vis = NULL;
/*reserve for NULL termination*/
int nvis = 1;
int nvis = 0;
int i = 0;
screen = XCBSetupRootsIter(XCBGetSetup(c)).data;
diter = XCBSCREENAllowedDepthsIter(screen);
for (; diter.rem; XCBDEPTHNext(&diter)) {
*depths = NULL;
for ( ; diter.rem; XCBDEPTHNext(&diter)) {
viter = XCBDEPTHVisualsIter (diter.data);
nvis += viter.rem;
vis = xrealloc(vis, sizeof(XCBVISUALTYPE) * (nvis+1));
*depths = xrealloc(*depths, sizeof(CARD8) * (nvis+1));
vis[nvis-1] = NULL;
vis = Xrealloc(vis, sizeof(XCBVISUALTYPE) * (nvis+1));
*depths = Xrealloc(*depths, sizeof(CARD8) * (nvis+1));
for ( ; viter.rem; XCBVISUALTYPENext(&viter)){
(*depths)[i] = diter.data->depth;
vis[i++] = viter.data;
}
}
*numvisuals = nvis-1;
*numvisuals = i;
return vis;
}
@ -100,7 +100,7 @@ static CARD8 *xnestListDepths(XCBConnection *c, int *numdepths)
for (; diter.rem; XCBDEPTHNext(&diter)) {
depths[i++]=diter.data->depth;
}
*numdepths = ndepth-1;
*numdepths = ndepth;
return depths;
}
@ -185,8 +185,7 @@ void xnestOpenDisplay(int argc, char *argv[])
for (i=0; i < xnestNumPixmapFormats; i++) {
for (j=0; j < xnestNumDepth; j++) {
if ((xnestPixmapFormats[i].depth == xnestDepths[j])||
(xnestPixmapFormats[i].depth == 1 )) {
if ((xnestPixmapFormats[i].depth == xnestDepths[j])|| (xnestPixmapFormats[i].depth == 1 )) {
xnestDefaultDrawables[xnestPixmapFormats[i].depth].pixmap = XCBPIXMAPNew(xnestConnection);
XCBCreatePixmap(xnestConnection,
xnestPixmapFormats[i].depth,

View file

@ -71,7 +71,8 @@ Bool xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
priv = (pointer)xalloc(sizeof(xnestPrivFont));
FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
xnestFontPriv(pFont)->font = XCBFONTNew(xnestConnection);
font = XCBFONTNew(xnestConnection);
xnestFontPriv(pFont)->font = font;
XCBOpenFont(xnestConnection, font, strlen(name), name);
if (!xnestFont(pFont).xid)

View file

@ -143,7 +143,7 @@ Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
DepthPtr depths;
int numVisuals, numDepths;
int i, j, depthIndex;
unsigned long valuemask;
unsigned long valuemask = 0;
XCBGetGeometryRep *rattr;
XCBGetGeometryCookie cattr;
XCBParamsCW param;
@ -151,6 +151,7 @@ Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
VisualID defaultVisual;
int rootDepth;
XCBSCREEN *screen;
XCBVISUALID vid;
if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
sizeof(xnestPrivWin)) &&
@ -387,20 +388,22 @@ Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
xnestDefaultWindows[pScreen->myNum],
XCBCWEventMask,
&xnestEventMask);
} else
} else {
vid.id = pScreen->rootVisual;
xnestDefaultWindows[pScreen->myNum] = XCBWINDOWNew(xnestConnection);
XCBAuxCreateWindow(xnestConnection,
pScreen->rootDepth,
xnestDefaultWindows[pScreen->myNum],
screen->root,
xnestX + POSITION_OFFSET,
xnestY + POSITION_OFFSET,
xnestWidth, xnestHeight,
xnestBorderWidth,
InputOutput,
xnestGetDefaultVisual(pScreen)->visual_id,
valuemask,
&param);
XCBAuxCreateWindow(xnestConnection,
pScreen->rootDepth,
xnestDefaultWindows[pScreen->myNum],
screen->root,
xnestX + POSITION_OFFSET,
xnestY + POSITION_OFFSET,
xnestWidth, xnestHeight,
xnestBorderWidth,
XCBWindowClassInputOutput,
vid,
valuemask,
&param);
}
if (!xnestWindowName)
xnestWindowName = argv[0];