summaryrefslogtreecommitdiff
path: root/Xext/geext.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-01-15 17:16:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-03-20 15:17:53 +1000
commit445daa62e720fe58fa2d6c3cdc26663671b2bc48 (patch)
tree715c70a4b89558934a5a95234098cc79cc3b9165 /Xext/geext.c
parent6fe4c28bf4f3a9f7c341b9403213470e9ded5cb3 (diff)
Xext: purge XGE event masks.
The masks were originally designed to generically handle event masks for extensions. Since all that is in-server anyway, it's much better writing custom event masks for those extensions that need it and not providing a unified mechanism. XI2 needs more than the current implementation, which is already too complex for most other extensions. good riddance. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xext/geext.c')
-rw-r--r--Xext/geext.c187
1 files changed, 0 insertions, 187 deletions
diff --git a/Xext/geext.c b/Xext/geext.c
index a58db038e..be2bac3f2 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -58,7 +58,6 @@ static const int version_requests[] = {
/* Forward declarations */
static void SGEGenericEvent(xEvent* from, xEvent* to);
-static void GERecalculateWinMask(WindowPtr pWin);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
@@ -217,43 +216,6 @@ SGEGenericEvent(xEvent* from, xEvent* to)
GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto);
}
-/**
- * Resource callback, invoked when the client disconnects and the associated
- * GE masks must be destroyed.
- */
-static int
-GEClientGone(WindowPtr pWin, XID id)
-{
- GenericClientMasksPtr gclmask;
- GenericMaskPtr gmask, prev = NULL;
-
- if (!pWin || !pWin->optional)
- return Success;
-
- gclmask = pWin->optional->geMasks;
- for (gmask = gclmask->geClients; gmask; gmask = gmask->next)
- {
- if (gmask->resource == id)
- {
- if (prev)
- {
- prev->next = gmask->next;
- xfree(gmask);
- } else {
- gclmask->geClients = NULL;
- CheckWindowOptionalNeed(pWin);
- GERecalculateWinMask(pWin);
- xfree(gmask);
- }
- return Success;
- }
- prev = gmask;
- }
-
- FatalError("Client not a GE client");
- return BadImplementation;
-}
-
/* Init extension, register at server.
* Since other extensions may rely on XGE (XInput does already), it is a good
* idea to init XGE first, before any other extension.
@@ -277,9 +239,6 @@ GEExtensionInit(void)
GEErrorBase = extEntry->errorBase;
GEEventType = GEEventBase;
- RT_GECLIENT = CreateNewResourceType((DeleteType)GEClientGone);
- RegisterResourceName(RT_GECLIENT, "GECLIENT");
-
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
@@ -326,149 +285,3 @@ GEInitEvent(xGenericEvent* ev, int extension)
ev->length = 0;
}
-/* Recalculates the summary mask for the window. */
-static void
-GERecalculateWinMask(WindowPtr pWin)
-{
- int i;
- GenericMaskPtr it;
- GenericClientMasksPtr evmasks;
-
- if (!pWin->optional)
- return;
-
- evmasks = pWin->optional->geMasks;
-
- for (i = 0; i < MAXEXTENSIONS; i++)
- {
- evmasks->eventMasks[i] = 0;
- }
-
- it = pWin->optional->geMasks->geClients;
- while(it)
- {
- for (i = 0; i < MAXEXTENSIONS; i++)
- {
- evmasks->eventMasks[i] |= it->eventMask[i];
- }
- it = it->next;
- }
-}
-
-/* Set generic event mask for given window. */
-void
-GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
- WindowPtr pWin, int extension, Mask mask)
-{
- GenericMaskPtr cli;
-
- extension = (extension & 0x7F);
-
- if (extension > MAXEXTENSIONS)
- {
- ErrorF("Invalid extension number.\n");
- return;
- }
-
- if (!pWin->optional && !MakeWindowOptional(pWin))
- {
- ErrorF("GE: Could not make window optional.\n");
- return;
- }
-
- if (mask)
- {
- GenericClientMasksPtr evmasks = pWin->optional->geMasks;
-
- /* check for existing client */
- cli = evmasks->geClients;
- while(cli)
- {
- if (rClient(cli) == pClient && cli->dev == pDev)
- break;
- cli = cli->next;
- }
- if (!cli)
- {
- /* new client and/or new device */
- cli = (GenericMaskPtr)xcalloc(1, sizeof(GenericMaskRec));
- if (!cli)
- {
- ErrorF("GE: Insufficient memory to alloc client.\n");
- return;
- }
- cli->next = evmasks->geClients;
- cli->resource = FakeClientID(pClient->index);
- cli->dev = pDev;
- evmasks->geClients = cli;
- AddResource(cli->resource, RT_GECLIENT, (pointer)pWin);
- }
- cli->eventMask[extension] = mask;
- } else
- {
- /* remove client. */
- cli = pWin->optional->geMasks->geClients;
- if (rClient(cli) == pClient && cli->dev == pDev)
- {
- pWin->optional->geMasks->geClients = cli->next;
- xfree(cli);
- } else
- {
- GenericMaskPtr prev = cli;
- cli = cli->next;
-
- while(cli)
- {
- if (rClient(cli) == pClient && cli->dev == pDev)
- {
- prev->next = cli->next;
- xfree(cli);
- break;
- }
- prev = cli;
- cli = cli->next;
- }
- }
- if (!cli)
- return;
- }
-
- GERecalculateWinMask(pWin);
-}
-
-/**
- * Return TRUE if the mask for the given device is set.
- * @param pWin Window the event may be delivered to.
- * @param pDev Device the device originating the event. May be NULL.
- * @param extension Extension ID
- * @param mask Event mask
- */
-BOOL
-GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
- int extension, Mask mask)
-{
- GenericMaskPtr gemask;
-
- if (!pWin->optional || !pWin->optional->geMasks)
- return FALSE;
-
- extension &= 0x7F;
-
- if (!pWin->optional->geMasks->eventMasks[extension] & mask)
- return FALSE;
-
-
- gemask = pWin->optional->geMasks->geClients;
-
- while(gemask)
- {
- if ((!gemask->dev || gemask->dev == pDev) &&
- (gemask->eventMask[extension] & mask))
- return TRUE;
-
- gemask = gemask->next;
- }
-
- return FALSE;
-}
-