Merge remote branch 'ajax/for-keithp'

This commit is contained in:
Keith Packard 2011-01-20 21:21:21 -08:00
commit be3be7580b
6 changed files with 42 additions and 79 deletions

View File

@ -167,7 +167,6 @@ typedef struct _Resource {
RESTYPE type; RESTYPE type;
pointer value; pointer value;
} ResourceRec, *ResourcePtr; } ResourceRec, *ResourcePtr;
#define NullResource ((ResourcePtr)NULL)
typedef struct _ClientResource { typedef struct _ClientResource {
ResourcePtr *resources; ResourcePtr *resources;
@ -176,7 +175,6 @@ typedef struct _ClientResource {
int hashsize; /* log(2)(buckets) */ int hashsize; /* log(2)(buckets) */
XID fakeID; XID fakeID;
XID endFakeID; XID endFakeID;
XID expectID;
} ClientResourceRec; } ClientResourceRec;
RESTYPE lastResourceType; RESTYPE lastResourceType;
@ -323,10 +321,9 @@ InitClientResources(ClientPtr client)
clientTable[i].fakeID = client->clientAsMask | clientTable[i].fakeID = client->clientAsMask |
(client->index ? SERVER_BIT : SERVER_MINID); (client->index ? SERVER_BIT : SERVER_MINID);
clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1; clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
clientTable[i].expectID = client->clientAsMask;
for (j=0; j<INITBUCKETS; j++) for (j=0; j<INITBUCKETS; j++)
{ {
clientTable[i].resources[j] = NullResource; clientTable[i].resources[j] = NULL;
} }
return TRUE; return TRUE;
} }
@ -512,8 +509,6 @@ AddResource(XID id, RESTYPE type, pointer value)
res->value = value; res->value = value;
*head = res; *head = res;
rrec->elements++; rrec->elements++;
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
rrec->expectID = id + 1;
CallResourceStateCallback(ResourceStateAdding, res); CallResourceStateCallback(ResourceStateAdding, res);
return TRUE; return TRUE;
} }
@ -543,7 +538,7 @@ RebuildTable(int client)
} }
for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
{ {
*rptr = NullResource; *rptr = NULL;
*tptr = rptr; *tptr = rptr;
} }
clientTable[client].hashsize++; clientTable[client].hashsize++;
@ -555,7 +550,7 @@ RebuildTable(int client)
for (res = *rptr; res; res = next) for (res = *rptr; res; res = next)
{ {
next = res->next; next = res->next;
res->next = NullResource; res->next = NULL;
tptr = &tails[Hash(client, res->id)]; tptr = &tails[Hash(client, res->id)];
**tptr = res; **tptr = res;
*tptr = &res->next; *tptr = &res->next;
@ -886,24 +881,21 @@ LegalNewID(XID id, ClientPtr client)
#ifdef PANORAMIX #ifdef PANORAMIX
XID minid, maxid; XID minid, maxid;
if (!noPanoramiXExtension) { if (!noPanoramiXExtension) {
minid = client->clientAsMask | (client->index ? minid = client->clientAsMask | (client->index ?
SERVER_BIT : SERVER_MINID); SERVER_BIT : SERVER_MINID);
maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1; maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
if ((id >= minid) && (id <= maxid)) if ((id >= minid) && (id <= maxid))
return TRUE; return TRUE;
} }
#endif /* PANORAMIX */ #endif /* PANORAMIX */
if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
{ {
if (clientTable[client->index].expectID <= id) rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
return TRUE; DixGetAttrAccess);
return rc == BadValue;
rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, }
DixGetAttrAccess); return FALSE;
return rc == BadValue;
}
return FALSE;
} }
int int

View File

@ -142,7 +142,7 @@ static void dmxConfigGetDims(int *maxWidth, int *maxHeight)
DMXConfigEntryPtr e; DMXConfigEntryPtr e;
*maxWidth = dmxConfigWallWidth = 0; *maxWidth = dmxConfigWallWidth = 0;
*maxWidth = dmxConfigWallHeight = 0; *maxHeight = dmxConfigWallHeight = 0;
if (!dmxConfigCurrent) return; if (!dmxConfigCurrent) return;
dmxConfigWallWidth = dmxConfigCurrent->width; dmxConfigWallWidth = dmxConfigCurrent->width;

View File

@ -855,7 +855,7 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap)
static void dmxBECreateResources(pointer value, XID id, RESTYPE type, static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
pointer n) pointer n)
{ {
int scrnNum = (int)n; int scrnNum = (uintptr_t)n;
ScreenPtr pScreen = screenInfo.screens[scrnNum]; ScreenPtr pScreen = screenInfo.screens[scrnNum];
if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
@ -1059,7 +1059,7 @@ static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
{ {
PicturePtr pPicture = value; /* The picture */ PicturePtr pPicture = value; /* The picture */
DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
int scrnNum = (int)n; int scrnNum = (uintptr_t)n;
if (pDraw->pScreen->myNum != scrnNum) { if (pDraw->pScreen->myNum != scrnNum) {
/* Picture not on the screen we are restoring*/ /* Picture not on the screen we are restoring*/
@ -1081,7 +1081,7 @@ static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n) static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
{ {
GlyphSetPtr glyphSet = value; GlyphSetPtr glyphSet = value;
int scrnNum = (int)n; int scrnNum = (uintptr_t)n;
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum]; DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
GlyphRefPtr table; GlyphRefPtr table;
@ -1274,7 +1274,7 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
for (i = currentMaxClients; --i >= 0; ) for (i = currentMaxClients; --i >= 0; )
if (clients[i]) if (clients[i])
FindAllClientResources(clients[i], dmxBECreateResources, FindAllClientResources(clients[i], dmxBECreateResources,
(pointer)idx); (pointer)(uintptr_t)idx);
/* Create window hierarchy (top down) */ /* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx); dmxBECreateWindowTree(idx);
@ -1283,13 +1283,15 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
for (i = currentMaxClients; --i >= 0; ) for (i = currentMaxClients; --i >= 0; )
if (clients[i]) if (clients[i])
FindClientResourcesByType(clients[i],PictureType, FindClientResourcesByType(clients[i],PictureType,
dmxBERestoreRenderPict,(pointer)idx); dmxBERestoreRenderPict,
(pointer)(uintptr_t)idx);
/* Restore the glyph state for RENDER */ /* Restore the glyph state for RENDER */
for (i = currentMaxClients; --i >= 0; ) for (i = currentMaxClients; --i >= 0; )
if (clients[i]) if (clients[i])
FindClientResourcesByType(clients[i],GlyphSetType, FindClientResourcesByType(clients[i],GlyphSetType,
dmxBERestoreRenderGlyph,(pointer)idx); dmxBERestoreRenderGlyph,
(pointer)(uintptr_t)idx);
/* Refresh screen by generating exposure events for all windows */ /* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx); dmxForceExposures(idx);
@ -1453,7 +1455,7 @@ static void dmxBESavePixmap(PixmapPtr pPixmap)
static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type, static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
pointer n) pointer n)
{ {
int scrnNum = (int)n; int scrnNum = (uintptr_t)n;
ScreenPtr pScreen = screenInfo.screens[scrnNum]; ScreenPtr pScreen = screenInfo.screens[scrnNum];
if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
@ -1596,7 +1598,7 @@ int dmxDetachScreen(int idx)
for (i = currentMaxClients; --i >= 0; ) for (i = currentMaxClients; --i >= 0; )
if (clients[i]) if (clients[i])
FindAllClientResources(clients[i], dmxBEDestroyResources, FindAllClientResources(clients[i], dmxBEDestroyResources,
(pointer)idx); (pointer)(uintptr_t)idx);
/* Free scratch GCs */ /* Free scratch GCs */
dmxBEDestroyScratchGCs(idx); dmxBEDestroyScratchGCs(idx);

View File

@ -383,12 +383,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
break; break;
case CT_PIXMAP: case CT_PIXMAP:
case CT_UNSORTED: /* Condensed down to REGION in the mi code */
case CT_YSORTED:
case CT_YXSORTED:
case CT_YXBANDED:
/* These clip types are condensed down to either NONE or REGION
in the mi code */
break; break;
} }

View File

@ -132,14 +132,6 @@ static DMXLocalInputInfoRec DMXConsoleKbd = {
NULL, dmxCommonKbdCtrl, dmxCommonKbdBell NULL, dmxCommonKbdCtrl, dmxCommonKbdBell
}; };
static DMXLocalInputInfoRec DMXCommonOth = {
"common-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_COMMON, 1,
dmxCommonCopyPrivate, NULL,
NULL, NULL, NULL, dmxCommonOthGetInfo,
dmxCommonOthOn, dmxCommonOthOff
};
static DMXLocalInputInfoRec DMXLocalDevices[] = { static DMXLocalInputInfoRec DMXLocalDevices[] = {
/* Dummy drivers that can compile on any OS */ /* Dummy drivers that can compile on any OS */
#ifdef __linux__ #ifdef __linux__
@ -615,7 +607,7 @@ static void dmxCollectAll(DMXInputInfo *dmxInput)
static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout,
pointer pReadMask) pointer pReadMask)
{ {
DMXInputInfo *dmxInput = &dmxInputs[(int)blockData]; DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
static unsigned long generation = 0; static unsigned long generation = 0;
if (generation != serverGeneration) { if (generation != serverGeneration) {
@ -642,7 +634,7 @@ static void dmxSwitchReturn(pointer p)
static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask) static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
{ {
DMXInputInfo *dmxInput = &dmxInputs[(int)blockData]; DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
int i; int i;
if (dmxInput->vt_switch_pending) { if (dmxInput->vt_switch_pending) {
@ -897,29 +889,6 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
} }
} }
break; break;
#if 0
case IsXExtensionDevice:
case IsXExtensionKeyboard:
case IsXExtensionPointer:
if (doXI) {
if (!dmxInput->numDevs) {
dmxLog(dmxWarning,
"Cannot use remote (%s) XInput devices if"
" not also using core devices\n",
dmxInput->name);
} else {
dmxLocal = dmxInputCopyLocal(dmxInput,
&DMXCommonOth);
dmxLocal->isCore = FALSE;
dmxLocal->sendsCore = FALSE;
dmxLocal->deviceId = devices[i].id;
dmxLocal->deviceName = (devices[i].name
? strdup(devices[i].name)
: NULL);
}
}
break;
#endif
} }
} }
XFreeDeviceList(devices); XFreeDeviceList(devices);
@ -1067,9 +1036,8 @@ void dmxInputInit(DMXInputInfo *dmxInput)
dmxInput->processInputEvents = dmxProcessInputEvents; dmxInput->processInputEvents = dmxProcessInputEvents;
dmxInput->detached = False; dmxInput->detached = False;
RegisterBlockAndWakeupHandlers(dmxBlockHandler, RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler,
dmxWakeupHandler, (void *)(uintptr_t)dmxInput->inputIdx);
(void *)dmxInput->inputIdx);
} }
static void dmxInputFreeLocal(DMXLocalInputInfoRec *local) static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)

View File

@ -153,13 +153,17 @@ WaitForSomething(int *pClientsReady)
fd_set clientsWritable; fd_set clientsWritable;
int curclient; int curclient;
int selecterr; int selecterr;
int nready; static int nready;
fd_set devicesReadable; fd_set devicesReadable;
CARD32 now = 0; CARD32 now = 0;
Bool someReady = FALSE; Bool someReady = FALSE;
FD_ZERO(&clientsReadable); FD_ZERO(&clientsReadable);
if (nready)
SmartScheduleStopTimer();
nready = 0;
/* We need a while loop here to handle /* We need a while loop here to handle
crashed connections and the screen saver timeout */ crashed connections and the screen saver timeout */
while (1) while (1)
@ -211,7 +215,6 @@ WaitForSomething(int *pClientsReady)
} }
XFD_COPYSET(&AllSockets, &LastSelectMask); XFD_COPYSET(&AllSockets, &LastSelectMask);
} }
SmartScheduleStopTimer ();
BlockHandler((pointer)&wt, (pointer)&LastSelectMask); BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
if (NewOutputPending) if (NewOutputPending)
@ -230,7 +233,6 @@ WaitForSomething(int *pClientsReady)
} }
selecterr = GetErrno(); selecterr = GetErrno();
WakeupHandler(i, (pointer)&LastSelectMask); WakeupHandler(i, (pointer)&LastSelectMask);
SmartScheduleStartTimer ();
if (i <= 0) /* An error or timeout occurred */ if (i <= 0) /* An error or timeout occurred */
{ {
if (dispatchException) if (dispatchException)
@ -388,6 +390,10 @@ WaitForSomething(int *pClientsReady)
#endif #endif
} }
} }
if (nready)
SmartScheduleStartTimer();
return nready; return nready;
} }