summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-11-07 15:37:23 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-11-07 15:37:23 +1030
commit0b729051c04da7068f1e6dd319190bd0a362b2c0 (patch)
tree6e15c5de67a40d04167fcf0a2e0e26af8eca11c2 /dix
parentb7ee005d327372c1e414ee6c526f9f7aee14bc86 (diff)
parentd7c5e8bfc1aecbd23a4cbb2eab08656587aac2e8 (diff)
Merge branch 'master' into mpx
Conflicts: Xi/extinit.c Xi/grabdev.c Xi/setmode.c Xi/ungrdev.c dix/devices.c dix/events.c dix/getevents.c include/dix.h mi/midispcur.c mi/misprite.c xkb/xkbActions.c xkb/xkbEvents.c xkb/xkbPrKeyEv.c
Diffstat (limited to 'dix')
-rw-r--r--dix/Makefile.am2
-rw-r--r--dix/colormap.c40
-rw-r--r--dix/devices.c26
-rw-r--r--dix/dispatch.c44
-rw-r--r--dix/dixfonts.c8
-rw-r--r--dix/events.c63
-rw-r--r--dix/extension.c6
-rw-r--r--dix/gc.c4
-rw-r--r--dix/getevents.c53
-rw-r--r--dix/globals.c1
-rw-r--r--dix/glyphcurs.c3
-rw-r--r--dix/grabs.c24
-rw-r--r--dix/main.c4
-rw-r--r--dix/pixmap.c2
-rw-r--r--dix/property.c16
-rw-r--r--dix/resource.c6
-rw-r--r--dix/swaprep.c12
-rw-r--r--dix/window.c11
18 files changed, 210 insertions, 115 deletions
diff --git a/dix/Makefile.am b/dix/Makefile.am
index 3f78eb0da..c060f9f1b 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -1,7 +1,7 @@
noinst_LTLIBRARIES = libdix.la libxpstubs.la
AM_CFLAGS = $(DIX_CFLAGS) \
- -DVENDOR_STRING=\""@VENDOR_STRING@"\" \
+ -DVENDOR_NAME=\""@VENDOR_NAME@"\" \
-DVENDOR_RELEASE="@VENDOR_RELEASE@"
libdix_la_SOURCES = \
diff --git a/dix/colormap.c b/dix/colormap.c
index 73b666971..b27b8bc67 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -751,7 +751,7 @@ UpdateColors (ColormapPtr pmap)
pVisual = pmap->pVisual;
size = pVisual->ColormapEntries;
- defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem));
+ defs = (xColorItem *)xalloc(size * sizeof(xColorItem));
if (!defs)
return;
n = 0;
@@ -801,7 +801,7 @@ UpdateColors (ColormapPtr pmap)
}
if (n)
(*pmap->pScreen->StoreColors)(pmap, n, defs);
- DEALLOCATE_LOCAL(defs);
+ xfree(defs);
}
/* Get a read-only color from a ColorMap (probably slow for large maps)
@@ -1752,14 +1752,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for(p = pixels; p < pixels + c; p++)
*p = 0;
- ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel));
- ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel));
- ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel));
+ ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel));
+ ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel));
+ ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel));
if (!ppixRed || !ppixGreen || !ppixBlue)
{
- if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue);
- if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen);
- if (ppixRed) DEALLOCATE_LOCAL(ppixRed);
+ if (ppixBlue) xfree(ppixBlue);
+ if (ppixGreen) xfree(ppixGreen);
+ if (ppixRed) xfree(ppixRed);
return(BadAlloc);
}
@@ -1797,9 +1797,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
if (okB)
for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
pmap->blue[*ppix].refcnt = 0;
- DEALLOCATE_LOCAL(ppixBlue);
- DEALLOCATE_LOCAL(ppixGreen);
- DEALLOCATE_LOCAL(ppixRed);
+ xfree(ppixBlue);
+ xfree(ppixGreen);
+ xfree(ppixRed);
return(BadAlloc);
}
@@ -1841,9 +1841,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for (pDst = pixels; pDst < pixels + c; pDst++)
*pDst |= ALPHAMASK(pmap->pVisual);
- DEALLOCATE_LOCAL(ppixBlue);
- DEALLOCATE_LOCAL(ppixGreen);
- DEALLOCATE_LOCAL(ppixRed);
+ xfree(ppixBlue);
+ xfree(ppixGreen);
+ xfree(ppixRed);
return (Success);
}
@@ -1859,7 +1859,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
npix = c << r;
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
return(BadAlloc);
- if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel))))
+ if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel))))
return(BadAlloc);
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
@@ -1889,7 +1889,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
pmap->numPixelsRed[client] += npix;
pmap->freeRed -= npix;
}
- DEALLOCATE_LOCAL(ppixTemp);
+ xfree(ppixTemp);
return (ok ? Success : BadAlloc);
}
@@ -2089,7 +2089,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
npixClientNew = c << (r + g + b);
npixShared = (c << r) + (c << g) + (c << b);
- psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared *
+ psharedList = (SHAREDCOLOR **)xalloc(npixShared *
sizeof(SHAREDCOLOR *));
if (!psharedList)
return FALSE;
@@ -2204,7 +2204,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
}
}
}
- DEALLOCATE_LOCAL(psharedList);
+ xfree(psharedList);
return TRUE;
}
@@ -2679,7 +2679,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
Colormap *pmaps;
int imap, nummaps, found;
- pmaps = (Colormap *) ALLOCATE_LOCAL(
+ pmaps = (Colormap *) xalloc(
pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
if(!pmaps)
return(FALSE);
@@ -2694,6 +2694,6 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
break;
}
}
- DEALLOCATE_LOCAL(pmaps);
+ xfree(pmaps);
return (found);
}
diff --git a/dix/devices.c b/dix/devices.c
index 37a98a090..c61ccc018 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1000,6 +1000,7 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
else
bzero((char *)keyc->modifierMap, MAP_LENGTH);
bzero((char *)keyc->down, DOWN_LENGTH);
+ bzero((char *)keyc->postdown, DOWN_LENGTH);
for (i = 0; i < 8; i++)
keyc->modifierKeyCount[i] = 0;
if (!SetKeySymsMap(&keyc->curKeySyms, pKeySyms) || !InitModMap(keyc))
@@ -1489,6 +1490,7 @@ int
ProcSetModifierMapping(ClientPtr client)
{
xSetModifierMappingReply rep;
+ DeviceIntPtr dev;
REQUEST(xSetModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
@@ -1504,8 +1506,9 @@ ProcSetModifierMapping(ClientPtr client)
rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1],
stuff->numKeyPerModifier);
- /* FIXME: Send mapping notifies for all the extended devices as well. */
- SendMappingNotify(inputInfo.keyboard, MappingModifier, 0, 0, client);
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ if (dev->key && dev->coreEvents)
+ SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
return client->noClientException;
}
@@ -1568,16 +1571,17 @@ ProcChangeKeyboardMapping(ClientPtr client)
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
keysyms.mapWidth = stuff->keySymsPerKeyCode;
keysyms.map = (KeySym *)&stuff[1];
- for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
- if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
if (!SetKeySymsMap(&pDev->key->curKeySyms, &keysyms))
return BadAlloc;
- }
- }
- /* FIXME: Send mapping notifies for all the extended devices as well. */
- SendMappingNotify(inputInfo.keyboard, MappingKeyboard,
- stuff->firstKeyCode, stuff->keyCodes, client);
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ if (pDev->key && pDev->coreEvents)
+ SendDeviceMappingNotify(client, MappingKeyboard,
+ stuff->firstKeyCode, stuff->keyCodes,
+ pDev);
+
return client->noClientException;
}
@@ -2131,7 +2135,7 @@ ProcGetMotionEvents(ClientPtr client)
{
if (CompareTimeStamps(stop, currentTime) == LATER)
stop = currentTime;
- coords = (xTimecoord *)ALLOCATE_LOCAL(mouse->valuator->numMotionEvents
+ coords = (xTimecoord *)xalloc(mouse->valuator->numMotionEvents
* sizeof(xTimecoord));
if (!coords)
return BadAlloc;
@@ -2165,7 +2169,7 @@ ProcGetMotionEvents(ClientPtr client)
(char *)coords);
}
if (coords)
- DEALLOCATE_LOCAL(coords);
+ xfree(coords);
return Success;
}
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 49e1a4b34..5e43902a6 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -406,7 +406,7 @@ Dispatch(void)
InitSelections();
nClients = 0;
- clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients);
+ clientReady = (int *) xalloc(sizeof(int) * MaxClients);
if (!clientReady)
return;
@@ -498,9 +498,9 @@ Dispatch(void)
if (result > (maxBigRequestSize << 2))
result = BadLength;
else {
- XaceHook(XACE_AUDIT_BEGIN, client);
+ XaceHookAuditBegin(client);
result = (* client->requestVector[MAJOROP])(client);
- XaceHook(XACE_AUDIT_END, client, result);
+ XaceHookAuditEnd(client, result);
}
#ifdef XSERVER_DTRACE
XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP,
@@ -535,7 +535,7 @@ Dispatch(void)
ddxBeforeReset ();
#endif
KillAllClients();
- DEALLOCATE_LOCAL(clientReady);
+ xfree(clientReady);
dispatchException &= ~DE_RESET;
#ifdef XSERVER_DTRACE
FreeRequestNames();
@@ -919,7 +919,7 @@ ProcQueryTree(ClientPtr client)
{
int curChild = 0;
- childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
+ childIDs = (Window *) xalloc(numChildren * sizeof(Window));
if (!childIDs)
return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
@@ -934,7 +934,7 @@ ProcQueryTree(ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
- DEALLOCATE_LOCAL(childIDs);
+ xfree(childIDs);
}
return(client->noClientException);
@@ -1402,7 +1402,7 @@ ProcQueryFont(ClientPtr client)
rlength = sizeof(xQueryFontReply) +
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
nprotoxcistructs * sizeof(xCharInfo);
- reply = (xQueryFontReply *)ALLOCATE_LOCAL(rlength);
+ reply = (xQueryFontReply *)xalloc(rlength);
if(!reply)
{
return(BadAlloc);
@@ -1414,7 +1414,7 @@ ProcQueryFont(ClientPtr client)
QueryFont( pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply);
- DEALLOCATE_LOCAL(reply);
+ xfree(reply);
return(client->noClientException);
}
}
@@ -1554,7 +1554,7 @@ ProcCreatePixmap(ClientPtr client)
CreatePmap:
pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap)
(pDraw->pScreen, stuff->width,
- stuff->height, stuff->depth);
+ stuff->height, stuff->depth, 0);
if (pMap)
{
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@@ -2260,7 +2260,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
length += widthBytesLine;
}
}
- if(!(pBuf = (char *) ALLOCATE_LOCAL(length)))
+ if(!(pBuf = (char *) xalloc(length)))
return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
}
@@ -2362,7 +2362,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
if (pVisibleRegion)
REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
if (!im_return)
- DEALLOCATE_LOCAL(pBuf);
+ xfree(pBuf);
return (client->noClientException);
}
@@ -2619,7 +2619,7 @@ ProcListInstalledColormaps(ClientPtr client)
return rc;
preply = (xListInstalledColormapsReply *)
- ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +
+ xalloc(sizeof(xListInstalledColormapsReply) +
pWin->drawable.pScreen->maxInstalledCmaps *
sizeof(Colormap));
if(!preply)
@@ -2634,7 +2634,7 @@ ProcListInstalledColormaps(ClientPtr client)
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
- DEALLOCATE_LOCAL(preply);
+ xfree(preply);
return(client->noClientException);
}
@@ -2761,7 +2761,7 @@ ProcAllocColorCells (ClientPtr client)
}
nmasks = stuff->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
- ppixels = (Pixel *)ALLOCATE_LOCAL(length);
+ ppixels = (Pixel *)xalloc(length);
if(!ppixels)
return(BadAlloc);
pmasks = ppixels + npixels;
@@ -2769,7 +2769,7 @@ ProcAllocColorCells (ClientPtr client)
if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks,
(Bool)stuff->contiguous, ppixels, pmasks)) )
{
- DEALLOCATE_LOCAL(ppixels);
+ xfree(ppixels);
if (client->noClientException != Success)
return(client->noClientException);
else
@@ -2788,7 +2788,7 @@ ProcAllocColorCells (ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
- DEALLOCATE_LOCAL(ppixels);
+ xfree(ppixels);
return (client->noClientException);
}
else
@@ -2829,7 +2829,7 @@ ProcAllocColorPlanes(ClientPtr client)
acpr.sequenceNumber = client->sequence;
acpr.nPixels = npixels;
length = (long)npixels * sizeof(Pixel);
- ppixels = (Pixel *)ALLOCATE_LOCAL(length);
+ ppixels = (Pixel *)xalloc(length);
if(!ppixels)
return(BadAlloc);
if( (retval = AllocColorPlanes(client->index, pcmp, npixels,
@@ -2837,7 +2837,7 @@ ProcAllocColorPlanes(ClientPtr client)
(Bool)stuff->contiguous, ppixels,
&acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
{
- DEALLOCATE_LOCAL(ppixels);
+ xfree(ppixels);
if (client->noClientException != Success)
return(client->noClientException);
else
@@ -2852,7 +2852,7 @@ ProcAllocColorPlanes(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
}
- DEALLOCATE_LOCAL(ppixels);
+ xfree(ppixels);
return (client->noClientException);
}
else
@@ -2981,12 +2981,12 @@ ProcQueryColors(ClientPtr client)
xQueryColorsReply qcr;
count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
- prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb));
+ prgbs = (xrgb *)xalloc(count * sizeof(xrgb));
if(!prgbs && count)
return(BadAlloc);
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
{
- if (prgbs) DEALLOCATE_LOCAL(prgbs);
+ if (prgbs) xfree(prgbs);
if (client->noClientException != Success)
return(client->noClientException);
else
@@ -3005,7 +3005,7 @@ ProcQueryColors(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
- if (prgbs) DEALLOCATE_LOCAL(prgbs);
+ if (prgbs) xfree(prgbs);
return(client->noClientException);
}
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 9d3bf084c..0e98b4e40 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -777,7 +777,7 @@ finish:
reply.nFonts = nnames;
reply.sequenceNumber = client->sequence;
- bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2);
+ bufptr = bufferStart = (char *) xalloc(reply.length << 2);
if (!bufptr && reply.length) {
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
@@ -802,7 +802,7 @@ finish:
client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
(void) WriteToClient(client, stringLens + nnames, bufferStart);
- DEALLOCATE_LOCAL(bufferStart);
+ xfree(bufferStart);
bail:
if (c->slept)
@@ -1797,7 +1797,7 @@ SetDefaultFontPath(char *path)
/* get enough for string, plus values -- use up commas */
len = strlen(path) + 1;
- nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
+ nump = cp = newpath = (unsigned char *) xalloc(len);
if (!newpath)
return BadAlloc;
pp = (unsigned char *) path;
@@ -1818,7 +1818,7 @@ SetDefaultFontPath(char *path)
err = SetFontPathElements(num, newpath, &bad, TRUE);
- DEALLOCATE_LOCAL(newpath);
+ xfree(newpath);
return err;
}
diff --git a/dix/events.c b/dix/events.c
index 2032b42ca..23ef861f6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2922,6 +2922,69 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
#endif
}
+/**
+ * Update the mouse sprite info when the server switches from a pScreen to another.
+ * Otherwise, the pScreen of the mouse sprite is never updated when we switch
+ * from a pScreen to another. Never updating the pScreen of the mouse sprite
+ * implies that windows that are in pScreen whose pScreen->myNum >0 will never
+ * get pointer events. This is because in CheckMotion(), sprite.hotPhys.pScreen
+ * always points to the first pScreen it has been set by
+ * DefineInitialRootWindow().
+ *
+ * Calling this function is useful for use cases where the server
+ * has more than one pScreen.
+ * This function is similar to DefineInitialRootWindow() but it does not
+ * reset the mouse pointer position.
+ * @param win must be the new pScreen we are switching to.
+ */
+void
+UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ SpritePtr pSprite = NULL;
+ WindowPtr win = NULL;
+ if (!pScreen)
+ return ;
+
+ if (!pDev->spriteInfo->sprite)
+ return;
+
+ pSprite = pDev->spriteInfo->sprite;
+
+ win = WindowTable[pScreen->myNum];
+
+ pSprite->hotPhys.pScreen = pScreen;
+ pSprite->hot = pSprite->hotPhys;
+ pSprite->hotLimits.x2 = pScreen->width;
+ pSprite->hotLimits.y2 = pScreen->height;
+#ifdef XEVIE
+ xeviewin =
+#endif
+ pSprite->win = win;
+ pSprite->current = wCursor (win);
+ pSprite->current->refcnt++;
+ pSprite->spriteTraceGood = 1;
+ pSprite->spriteTrace[0] = win;
+ (*pScreen->CursorLimits) (pDev,
+ pScreen,
+ pSprite->current,
+ &pSprite->hotLimits,
+ &pSprite->physLimits);
+ pSprite->confined = FALSE;
+ (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits);
+ (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x;
+ pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y;
+ pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
+ pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
+ pSprite->physLimits = pSprite->hotLimits;
+ pSprite->screen = pScreen;
+ }
+#endif
+}
+
/*
* This does not take any shortcuts, and even ignores its argument, since
* it does not happen very often, and one has to walk up the tree since
diff --git a/dix/extension.c b/dix/extension.c
index 186574d76..282d60ab7 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -184,6 +184,8 @@ _X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
char *name;
char **aliases;
+ if (!ext)
+ return FALSE ;
aliases = (char **)xrealloc(ext->aliases,
(ext->num_aliases + 1) * sizeof(char *));
if (!aliases)
@@ -362,7 +364,7 @@ ProcListExtensions(ClientPtr client)
total_length += strlen(extensions[i]->aliases[j]) + 1;
}
reply.length = (total_length + 3) >> 2;
- buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length);
+ buffer = bufptr = (char *)xalloc(total_length);
if (!buffer)
return(BadAlloc);
for (i=0; i<NumExtensions; i++)
@@ -386,7 +388,7 @@ ProcListExtensions(ClientPtr client)
if (reply.length)
{
WriteToClient(client, total_length, buffer);
- DEALLOCATE_LOCAL(buffer);
+ xfree(buffer);
}
return(client->noClientException);
}
diff --git a/dix/gc.c b/dix/gc.c
index 7a76dd99d..5dbb6bf09 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -694,7 +694,7 @@ CreateDefaultTile (GCPtr pGC)
(*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen);
pTile = (PixmapPtr)
(*pGC->pScreen->CreatePixmap)(pGC->pScreen,
- w, h, pGC->depth);
+ w, h, pGC->depth, 0);
pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
if (!pTile || !pgcScratch)
{
@@ -1036,7 +1036,7 @@ CreateDefaultStipple(int screenNum)
h = 16;
(* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen);
if (!(pScreen->PixmapPerDepth[0] =
- (*pScreen->CreatePixmap)(pScreen, w, h, 1)))
+ (*pScreen->CreatePixmap)(pScreen, w, h, 1, 0)))
return FALSE;
/* fill stipple with 1 */
tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid;
diff --git a/dix/getevents.c b/dix/getevents.c
index 7457078e5..934b0e905 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -85,6 +85,30 @@ GetMotionHistorySize(void)
return MOTION_HISTORY_SIZE;
}
+static void
+set_key_down(DeviceIntPtr pDev, int key_code)
+{
+ pDev->key->postdown[key_code >> 3] |= (1 << (key_code & 7));
+}
+
+static void
+set_key_up(DeviceIntPtr pDev, int key_code)
+{
+ pDev->key->postdown[key_code >> 3] &= ~(1 << (key_code & 7));
+}
+
+static Bool
+key_is_down(DeviceIntPtr pDev, int key_code)
+{
+ return !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+}
+
+static Bool
+key_autorepeats(DeviceIntPtr pDev, int key_code)
+{
+ return !!(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3] &
+ (1 << (key_code & 7)));
+}
/**
* Allocate the motion history buffer.
@@ -256,7 +280,7 @@ acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
}
}
else {
- mult = pow((float)(dx * dx + dy * dy),
+ mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
((float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den) - 1.0) /
2.0) / 2.0;
@@ -395,6 +419,7 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
if (!events)
return 0;
+ /* DO NOT WANT */
if (type != KeyPress && type != KeyRelease)
return 0;
@@ -404,6 +429,9 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
numEvents = 1;
+ if (key_code < 8 || key_code > 255)
+ return 0;
+
if (num_valuators) {
if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS;
@@ -421,21 +449,20 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
case XK_Shift_Lock:
if (type == KeyRelease)
return 0;
- else if (type == KeyPress &&
- (pDev->key->down[key_code >> 3] & (key_code & 7)) & 1)
- type = KeyRelease;
+ else if (type == KeyPress && key_is_down(pDev, key_code))
+ type = KeyRelease;
}
}
/* Handle core repeating, via press/release/press/release.
* FIXME: In theory, if you're repeating with two keyboards in non-XKB,
* you could get unbalanced events here. */
- if (type == KeyPress &&
- (((pDev->key->down[key_code >> 3] & (key_code & 7))) & 1)) {
+ if (type == KeyPress && key_is_down(pDev, key_code)) {
+ /* If autorepeating is disabled either globally or just for that key,
+ * or we have a modifier, don't generate a repeat event. */
if (!pDev->kbdfeed->ctrl.autoRepeat ||
- pDev->key->modifierMap[key_code] ||
- !(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
- & (1 << (key_code & 7))))
+ !key_autorepeats(pDev, key_code) ||
+ pDev->key->modifierMap[key_code])
return 0;
#ifdef XKB
@@ -456,10 +483,14 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
kbp->time = ms;
kbp->deviceid = pDev->id;
kbp->detail = key_code;
- if (type == KeyPress)
+ if (type == KeyPress) {
kbp->type = DeviceKeyPress;
- else if (type == KeyRelease)
+ set_key_down(pDev, key_code);
+ }
+ else if (type == KeyRelease) {
kbp->type = DeviceKeyRelease;
+ set_key_up(pDev, key_code);
+ }
events++;
if (num_valuators) {
diff --git a/dix/globals.c b/dix/globals.c
index f86c6026d..d76b604da 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -136,7 +136,6 @@ Bool screenSaverSuspended = FALSE;
char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
char *defaultTextFont = COMPILEDDEFAULTFONT;
char *defaultCursorFont = COMPILEDCURSORFONT;
-char *rgbPath = RGB_DB;
char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
every compilation of dix code */
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index 70b1ff8f7..905b5fb13 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -98,7 +98,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
bzero(pbits, nby);
ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
- cm->height, 1);
+ cm->height, 1,
+ CREATE_PIXMAP_USAGE_SCRATCH);
pGC = GetScratchGC(1, pScreen);
if (!ppix || !pGC)
{
diff --git a/dix/grabs.c b/dix/grabs.c
index d51511cd8..b907e9c0e 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -387,16 +387,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
i++;
if (!i)
return TRUE;
- deletes = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr));
- adds = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr));
- updates = (Mask ***)ALLOCATE_LOCAL(i * sizeof(Mask **));
- details = (Mask **)ALLOCATE_LOCAL(i * sizeof(Mask *));
+ deletes = (GrabPtr *)xalloc(i * sizeof(GrabPtr));
+ adds = (GrabPtr *)xalloc(i * sizeof(GrabPtr));
+ updates = (Mask ***)xalloc(i * sizeof(Mask **));
+ details = (Mask **)xalloc(i * sizeof(Mask *));
if (!deletes || !adds || !updates || !details)
{
- if (details) DEALLOCATE_LOCAL(details);
- if (updates) DEALLOCATE_LOCAL(updates);
- if (adds) DEALLOCATE_LOCAL(adds);
- if (deletes) DEALLOCATE_LOCAL(deletes);
+ if (details) xfree(details);
+ if (updates) xfree(updates);
+ if (adds) xfree(adds);
+ if (deletes) xfree(deletes);
return FALSE;
}
ndels = nadds = nups = 0;
@@ -491,10 +491,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
*updates[i] = details[i];
}
}
- DEALLOCATE_LOCAL(details);
- DEALLOCATE_LOCAL(updates);
- DEALLOCATE_LOCAL(adds);
- DEALLOCATE_LOCAL(deletes);
+ xfree(details);
+ xfree(updates);
+ xfree(adds);
+ xfree(deletes);
return ok;
#undef UPDATE
diff --git a/dix/main.c b/dix/main.c
index d78d7e8ee..0bb823d26 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -453,6 +453,8 @@ main(int argc, char *argv[], char *envp[])
}
}
+ NotifyParentProcess();
+
Dispatch();
UndisplayDevices();
@@ -514,7 +516,7 @@ main(int argc, char *argv[], char *envp[])
}
static int VendorRelease = VENDOR_RELEASE;
-static char *VendorString = VENDOR_STRING;
+static char *VendorString = VENDOR_NAME;
void
SetVendorRelease(int release)
diff --git a/dix/pixmap.c b/dix/pixmap.c
index c280a3b94..5b9a6a3aa 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -59,7 +59,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
pScreen->pScratchPixmap = NULL;
else
/* width and height of 0 means don't allocate any pixmap data */
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth);
+ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0);
if (pPixmap) {
if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
diff --git a/dix/property.c b/dix/property.c
index 676810050..1f6b004fb 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -122,7 +122,7 @@ ProcRotateProperties(ClientPtr client)
if (!stuff->nAtoms)
return(Success);
atoms = (Atom *) & stuff[1];
- props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr));
+ props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr));
if (!props)
return(BadAlloc);
for (i = 0; i < stuff->nAtoms; i++)
@@ -131,19 +131,19 @@ ProcRotateProperties(ClientPtr client)
DixReadAccess|DixWriteAccess);
if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) {
- DEALLOCATE_LOCAL(props);
+ xfree(props);
client->errorValue = atoms[i];
return BadAtom;
}
if (XaceIgnoreOperation == action) {
- DEALLOCATE_LOCAL(props);
+ xfree(props);
return Success;
}
for (j = i + 1; j < stuff->nAtoms; j++)
if (atoms[j] == atoms[i])
{
- DEALLOCATE_LOCAL(props);
+ xfree(props);
return BadMatch;
}
pProp = wUserProps (pWin);
@@ -153,7 +153,7 @@ ProcRotateProperties(ClientPtr client)
goto found;
pProp = pProp->next;
}
- DEALLOCATE_LOCAL(props);
+ xfree(props);
return BadMatch;
found:
props[i] = pProp;
@@ -175,7 +175,7 @@ found:
props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
}
}
- DEALLOCATE_LOCAL(props);
+ xfree(props);
return Success;
}
@@ -575,7 +575,7 @@ ProcListProperties(ClientPtr client)
numProps++;
}
if (numProps)
- if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom))))
+ if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
return(BadAlloc);
xlpr.type = X_Reply;
@@ -594,7 +594,7 @@ ProcListProperties(ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
- DEALLOCATE_LOCAL(pAtoms);
+ xfree(pAtoms);
}
return(client->noClientException);
}
diff --git a/dix/resource.c b/dix/resource.c
index e5bc90065..4234beb8b 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -507,13 +507,13 @@ RebuildTable(int client)
*/
j = 2 * clientTable[client].buckets;
- tails = (ResourcePtr **)ALLOCATE_LOCAL(j * sizeof(ResourcePtr *));
+ tails = (ResourcePtr **)xalloc(j * sizeof(ResourcePtr *));
if (!tails)
return;
resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr));
if (!resources)
{
- DEALLOCATE_LOCAL(tails);
+ xfree(tails);
return;
}
for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
@@ -536,7 +536,7 @@ RebuildTable(int client)
*tptr = &res->next;
}
}
- DEALLOCATE_LOCAL(tails);
+ xfree(tails);
clientTable[client].buckets *= 2;
xfree(clientTable[client].resources);
clientTable[client].resources = resources;
diff --git a/dix/swaprep.c b/dix/swaprep.c
index 7d3251ae3..91469e17b 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -101,7 +101,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
CARD32 tmpbuf[1];
/* Allocate as big a buffer as we can... */
- while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize)))
+ while (!(pbufT = (CARD32 *) xalloc(bufsize)))
{
bufsize >>= 1;
if (bufsize == 4)
@@ -133,7 +133,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
}
if (pbufT != tmpbuf)
- DEALLOCATE_LOCAL ((char *) pbufT);
+ xfree ((char *) pbufT);
}
/**
@@ -149,7 +149,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
short tmpbuf[2];
/* Allocate as big a buffer as we can... */
- while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize)))
+ while (!(pbufT = (short *) xalloc(bufsize)))
{
bufsize >>= 1;
if (bufsize == 4)
@@ -181,7 +181,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
}
if (pbufT != tmpbuf)
- DEALLOCATE_LOCAL ((char *) pbufT);
+ xfree ((char *) pbufT);
}
@@ -1267,7 +1267,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
{
char *pInfoTBase;
- pInfoTBase = (char *) ALLOCATE_LOCAL(size);
+ pInfoTBase = (char *) xalloc(size);
if (!pInfoTBase)
{
pClient->noClientException = -1;
@@ -1275,7 +1275,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
}
SwapConnSetupInfo(pInfo, pInfoTBase);
(void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
- DEALLOCATE_LOCAL(pInfoTBase);
+ xfree(pInfoTBase);
}
_X_EXPORT void
diff --git a/dix/window.c b/dix/window.c
index f296d34be..23acbd63b 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -187,7 +187,6 @@ static Bool TileScreenSaver(int i, int kind);
#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
-
_X_EXPORT int numSaveUndersViewable = 0;
_X_EXPORT int deltaSaveUndersViewable = 0;
@@ -332,7 +331,7 @@ MakeRootTile(WindowPtr pWin)
int i, j;
pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
- pScreen->rootDepth);
+ pScreen->rootDepth, 0);
pWin->backgroundState = BackgroundPixmap;
pGC = GetScratchGC(pScreen->rootDepth, pScreen);
@@ -1571,7 +1570,7 @@ PatchUp:
REGION_NULL(pScreen, &exposed);
REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize);
- (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER);
+ miPaintWindow(pWin, &exposed, PW_BORDER);
REGION_UNINIT(pScreen, &exposed);
}
return error;
@@ -3079,9 +3078,6 @@ UnrealizeTree(
deltaSaveUndersViewable--;
#endif
pChild->viewable = FALSE;
- if (pChild->backStorage)
- (*pChild->drawable.pScreen->SaveDoomedAreas)(
- pChild, &pChild->clipList, 0, 0);
(* MarkUnrealizedWindow)(pChild, pWin, fromConfigure);
pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
}
@@ -3209,9 +3205,6 @@ UnmapSubwindows(WindowPtr pWin)
#ifdef DO_SAVE_UNDERS
pChild->DIXsaveUnder = FALSE;
#endif /* DO_SAVE_UNDERS */
- if (pChild->backStorage)
- (*pScreen->SaveDoomedAreas)(
- pChild, &pChild->clipList, 0, 0);
}
}
}