diff options
Diffstat (limited to 'xorg-server/Xext/geext.c')
-rw-r--r-- | xorg-server/Xext/geext.c | 192 |
1 files changed, 1 insertions, 191 deletions
diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c index 7ab99517d..1ddcbb1f6 100644 --- a/xorg-server/Xext/geext.c +++ b/xorg-server/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; @@ -302,16 +261,13 @@ GEExtensionInit(void) */ void GERegisterExtension(int extension, - void (*ev_swap)(xGenericEvent* from, xGenericEvent* to), - void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev, - WindowPtr pWin, GrabPtr pGrab)) + void (*ev_swap)(xGenericEvent* from, xGenericEvent* to)) { if ((extension & 0x7F) >= MAXEXTENSIONS) FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n"); /* extension opcodes are > 128, might as well save some space here */ GEExtensions[extension & 0x7f].evswap = ev_swap; - GEExtensions[extension & 0x7f].evfill = ev_fill; } @@ -326,149 +282,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; -} - |