diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-01-15 17:16:22 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-20 15:17:53 +1000 |
commit | 445daa62e720fe58fa2d6c3cdc26663671b2bc48 (patch) | |
tree | 715c70a4b89558934a5a95234098cc79cc3b9165 | |
parent | 6fe4c28bf4f3a9f7c341b9403213470e9ded5cb3 (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>
-rw-r--r-- | Xext/geext.c | 187 | ||||
-rw-r--r-- | Xext/geext.h | 21 | ||||
-rw-r--r-- | Xi/exevents.c | 1 | ||||
-rw-r--r-- | Xi/extgrbdev.c | 116 | ||||
-rw-r--r-- | Xi/extinit.c | 51 | ||||
-rw-r--r-- | Xi/xiselev.c | 2 | ||||
-rw-r--r-- | dix/events.c | 303 | ||||
-rw-r--r-- | dix/grabs.c | 1 | ||||
-rw-r--r-- | dix/window.c | 35 | ||||
-rw-r--r-- | include/dix.h | 12 | ||||
-rw-r--r-- | include/inputstr.h | 1 | ||||
-rw-r--r-- | include/windowstr.h | 11 |
12 files changed, 58 insertions, 683 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; -} - diff --git a/Xext/geext.h b/Xext/geext.h index e37d507df..fbf29cc0d 100644 --- a/Xext/geext.h +++ b/Xext/geext.h @@ -34,22 +34,6 @@ from the author. #define _GEEXT_H_ #include <X11/extensions/geproto.h> - -/** - * This struct is used both in the window and by grabs to determine the event - * mask for a client. - * A window will have a linked list of these structs, with one entry per - * client per device, null-terminated. - * A grab has only one instance of this struct. - */ -typedef struct _GenericMaskRec { - struct _GenericMaskRec* next; - XID resource; /* id for the resource manager */ - DeviceIntPtr dev; - Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */ -} GenericMaskRec, *GenericMaskPtr; - - /* Struct to keep information about registered extensions * * evswap ... use to swap event fields for different byte ordered clients. @@ -96,9 +80,6 @@ extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS]; /* Interface for other extensions */ -extern _X_EXPORT void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev, - WindowPtr pWin, int extension, Mask mask); - extern _X_EXPORT void GERegisterExtension( int extension, void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to), @@ -107,8 +88,6 @@ extern _X_EXPORT void GERegisterExtension( ); extern _X_EXPORT void GEInitEvent(xGenericEvent* ev, int extension); -extern _X_EXPORT BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev, - int extension, Mask mask); extern _X_EXPORT void GEExtensionInit(void); diff --git a/Xi/exevents.c b/Xi/exevents.c index 89adf4f30..885148734 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1787,7 +1787,6 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, tempGrab.pointerMode = GrabModeAsync; tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; - tempGrab.genericMasks = NULL; tempGrab.next = NULL; (*dev->deviceGrab.ActivateGrab) (dev, &tempGrab, currentTime, TRUE); } diff --git a/Xi/extgrbdev.c b/Xi/extgrbdev.c index af8706320..da4e618c2 100644 --- a/Xi/extgrbdev.c +++ b/Xi/extgrbdev.c @@ -86,121 +86,7 @@ SProcXExtendedGrabDevice(ClientPtr client) int ProcXExtendedGrabDevice(ClientPtr client) { - xExtendedGrabDeviceReply rep; - DeviceIntPtr dev; - int rc = Success, - errval = 0, - i; - WindowPtr grab_window, - confineTo = 0; - CursorPtr cursor = NULL; - struct tmask tmp[EMASKSIZE]; - TimeStamp time; - XGenericEventMask* xgeMask; - GenericMaskPtr gemasks = NULL; - - REQUEST(xExtendedGrabDeviceReq); - REQUEST_AT_LEAST_SIZE(xExtendedGrabDeviceReq); - - rep.repType = X_Reply; - rep.RepType = X_ExtendedGrabDevice; - rep.sequenceNumber = client->sequence; - rep.length = 0; - - if (stuff->length != (sizeof(xExtendedGrabDeviceReq) >> 2) + - stuff->event_count + 2 * stuff->generic_event_count) - { - errval = 0; - rc = BadLength; - goto cleanup; - } - - rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); - if (rc != Success) { - goto cleanup; - } - - rc = dixLookupWindow(&grab_window, - stuff->grab_window, - client, - DixReadAccess); - if (rc != Success) - { - errval = stuff->grab_window; - goto cleanup; - } - - if (stuff->confine_to) - { - rc = dixLookupWindow(&confineTo, - stuff->confine_to, - client, - DixReadAccess); - if (rc != Success) - { - errval = stuff->confine_to; - goto cleanup; - } - } - - if (stuff->cursor) - { - cursor = (CursorPtr)SecurityLookupIDByType(client, - stuff->cursor, - RT_CURSOR, - DixReadAccess); - if (!cursor) - { - errval = stuff->cursor; - rc = BadCursor; - goto cleanup; - } - } - - if (CreateMaskFromList(client, - (XEventClass*)&stuff[1], - stuff->event_count, - tmp, - dev, - X_GrabDevice) != Success) - return Success; - - time = ClientTimeToServerTime(stuff->time); - - if (stuff->generic_event_count) - { - xgeMask = - (XGenericEventMask*)(((XEventClass*)&stuff[1]) + stuff->event_count); - - gemasks = xcalloc(1, sizeof(GenericMaskRec)); - gemasks->resource = FakeClientID(client->index); - gemasks->next = NULL; - gemasks->eventMask[xgeMask->extension & 0x7F] = xgeMask->evmask; - - xgeMask++; - for (i = 1; i < stuff->generic_event_count; i++, xgeMask++) - gemasks->eventMask[xgeMask->extension & 0x7F]= xgeMask->evmask; - } - - rep.status = ExtGrabDevice(client, dev, stuff->device_mode, - grab_window, confineTo, time, - stuff->owner_events, cursor, - tmp[stuff->deviceid].mask, - gemasks); -cleanup: - - if (gemasks) - xfree(gemasks); - - if (rc == Success) - { - WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep); - } - else - { - return rc; - } - return Success; + return BadRequest; } void diff --git a/Xi/extinit.c b/Xi/extinit.c index 9a20bfdc3..4d35c4800 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -154,16 +154,6 @@ const Mask XIAllMasks = (1L << 21) - 1; int ExtEventIndex; Mask ExtExclusiveMasks[EMASKSIZE]; - -/** - * Filters for various generic events. - * Evtype is index, mask is value at index. - */ -static Mask xi_filters[] = { - XI_DeviceHierarchyChangedMask, - XI_DeviceClassesChangedMask, -}; - static struct dev_type { Atom type; @@ -671,6 +661,12 @@ SDeviceClassesChangedEvent(deviceClassesChangedEvent* from, } } +/** Event swapping function for XI2 events. */ +static void +XI2EventSwap(xGenericEvent *from, xGenericEvent *to) +{ +} + /************************************************************************** * * Allow the specified event to have its propagation suppressed. @@ -1034,36 +1030,6 @@ SEventIDispatch(xEvent * from, xEvent * to) } } -/**************************************************************** - * - * EventSwap for generic events coming from the GE extension. - */ - -static void -XIGEEventSwap(xGenericEvent* from, xGenericEvent* to) -{ - int n; - - swaps(&from->sequenceNumber, n); - switch(from->evtype) - { - case XI_DeviceClassesChangedNotify: - SDeviceClassesChangedEvent((deviceClassesChangedEvent*)from, - (deviceClassesChangedEvent*)to); - break; - } -} - -/** - * EventFill to fill various fields for events before they are delivered to - * the client. - */ -static void -XIGEEventFill(xGenericEvent* ev, DeviceIntPtr pDev, - WindowPtr pWin, GrabPtr grab) -{ -} - /********************************************************************** * * IExtensionInit - initialize the input extension. @@ -1117,10 +1083,9 @@ XInputExtensionInit(void) EventSwapVector[DeviceEnterNotify] = SEventIDispatch; EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; - /* init GE events */ - GERegisterExtension(IReqCode, XIGEEventSwap, XIGEEventFill); - SetGenericFilter(IReqCode, xi_filters); + GERegisterExtension(IReqCode, XI2EventSwap, NULL); } else { FatalError("IExtensionInit: AddExtensions failed\n"); } } + diff --git a/Xi/xiselev.c b/Xi/xiselev.c index 0431939e7..229f2d1f6 100644 --- a/Xi/xiselev.c +++ b/Xi/xiselev.c @@ -72,7 +72,7 @@ ProcXiSelectEvent(ClientPtr client) return rc; } - GEWindowSetMask(client, pDev, pWin, IReqCode, stuff->mask); + /* XXX: THIS FUNCTION IS NOW DYSFUNCTIONAL */ return Success; } diff --git a/dix/events.c b/dix/events.c index c21e57ebe..2969adba2 100644 --- a/dix/events.c +++ b/dix/events.c @@ -396,13 +396,6 @@ static Mask filters[MAXDEVICES][128] = { }}; -/** - * same principle as filters, but one set of filters for each extension. - * The extension is responsible for setting the filters by calling - * SetGenericFilter(). - */ -static Mask* generic_filters[MAXEXTENSIONS]; - static CARD8 criticalEvents[32] = { 0x7c, 0x30, 0x40 /* key, button, expose, and configure events */ @@ -1466,13 +1459,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse) mouse->deviceGrab.sync.state = NOT_GRABBED; mouse->deviceGrab.fromPassiveGrab = FALSE; - /* make sure the potential XGE event mask is freed too*/ - if (grab->genericMasks) - { - xfree(grab->genericMasks); - grab->genericMasks = NULL; - } - for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.sync.other == grab) @@ -1550,11 +1536,6 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd) keybd->deviceGrab.grab = NullGrab; keybd->deviceGrab.sync.state = NOT_GRABBED; keybd->deviceGrab.fromPassiveGrab = FALSE; - if (grab->genericMasks) - { - xfree(grab->genericMasks); - grab->genericMasks = NULL; - } for (dev = inputInfo.devices; dev; dev = dev->next) { @@ -1937,43 +1918,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent } if (filter != CantBeFiltered) { - /* Handle generic events */ - if (type == GenericEvent) - { - GenericMaskPtr gmask; - /* We don't do more than one GenericEvent at a time. */ - if (count > 1) - { - ErrorF("[dix] Do not send more than one GenericEvent at a time!\n"); - return 0; - } - - /* if we get here, filter should be set to the GE specific mask. - check if any client wants it */ - if (!GEDeviceMaskIsSet(pWin, pDev, GEEXT(pEvents), filter)) - return 0; - - /* run through all clients, deliver event */ - for (gmask = GECLIENT(pWin); gmask; gmask = gmask->next) - { - if (gmask->eventMask[GEEXTIDX(pEvents)] & filter) - { - if (XaceHook(XACE_RECEIVE_ACCESS, rClient(gmask), pWin, - pEvents, count)) - /* do nothing */; - else if (TryClientEvents(rClient(gmask), pDev, - pEvents, count, - gmask->eventMask[GEEXTIDX(pEvents)], - filter, grab) > 0) - { - deliveries++; - } else - nondeliveries--; - } - } - } - else { - /* Traditional event */ if (type & EXTENSION_EVENT_BASE) { OtherInputMasks *inputMasks; @@ -2010,7 +1954,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent nondeliveries--; } } - } } /* * Note that since core events are delivered first, an implicit grab may @@ -2039,21 +1982,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent inputMasks = wOtherInputMasks(pWin); tempGrab.deviceMask = (inputMasks) ? inputMasks->inputEvents[pDev->id]: 0; - /* get the XGE event mask. */ - tempGrab.genericMasks = NULL; - if (pWin->optional && pWin->optional->geMasks) - { - GenericClientMasksPtr gemasks = pWin->optional->geMasks; - GenericMaskPtr geclient = gemasks->geClients; - while(geclient && rClient(geclient) != client) - geclient = geclient->next; - if (geclient) - { - tempGrab.genericMasks = xcalloc(1, sizeof(GenericMaskRec)); - *tempGrab.genericMasks = *geclient; - tempGrab.genericMasks->next = NULL; - } - } (*pDev->deviceGrab.ActivateGrab)(pDev, &tempGrab, currentTime, TRUE | ImplicitGrabMask); } @@ -2269,39 +2197,6 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, type = xE->u.u.type; filter = filters[dev->id][type]; - /* handle generic events */ - /* XXX: Generic events aren't quite handled correctly yet. They should - * eventually fit in with the rest of the stuff - */ - if (type == GenericEvent) - { - WindowPtr win = pWin; - xGenericEvent* ge = (xGenericEvent*)xE; - - if (count > 1) - { - ErrorF("[dix] Do not send more than one GenericEvent at a time!\n"); - deliveries = 0; - goto unwind; - } - filter = generic_filters[GEEXTIDX(xE)][ge->evtype]; - - while(win) - { - if (GEDeviceMaskIsSet(win, dev, GEEXT(xE), filter)) - { - if (GEExtensions[GEEXTIDX(xE)].evfill) - GEExtensions[GEEXTIDX(xE)].evfill(ge, dev, win, grab); - deliveries = DeliverEventsToWindow(dev, win, xE, count, - filter, grab, 0); - if (deliveries > 0) - goto unwind; - } - - win = win->parent; - } - } - while (pWin && type != GenericEvent) { /* First try XI event delivery */ @@ -3537,6 +3432,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, } if (!deliveries) { + Mask mask; /* XXX: In theory, we could pass the internal events through to * everything and only convert just before hitting the wire. We can't * do that yet, so DGE is the last stop for internal events. From here @@ -3552,80 +3448,63 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, } else if (count == 0) /* no XI/Core event for you */ goto unwind; - if (xi->u.u.type == GenericEvent) - { - /* find evmask for event's extension */ - xGenericEvent* ge = ((xGenericEvent*)xi); - GenericMaskPtr gemask = grab->genericMasks; - - if (!gemask || !gemask->eventMask[GEEXTIDX(ge)]) - goto unwind; + mask = grab->eventMask; - if (GEEventFill(xi)) - GEEventFill(xi)(ge, thisDev, grab->window, grab); - deliveries = TryClientEvents(rClient(grab), thisDev, xi, - count, gemask->eventMask[GEEXTIDX(ge)], - generic_filters[GEEXTIDX(ge)][ge->evtype], - grab); - } else + sendCore = (thisDev->isMaster && thisDev->coreEvents); + /* try core event */ + if (sendCore && grab->coreGrab) { - Mask mask = grab->eventMask; + xEvent core; - sendCore = (thisDev->isMaster && thisDev->coreEvents); - /* try core event */ - if (sendCore && grab->coreGrab) + rc = EventToCore(event, &core); + if (rc != Success && rc != BadMatch) { - xEvent core; - - rc = EventToCore(event, &core); - if (rc != Success && rc != BadMatch) - { - ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n"); - goto unwind; - } - - FixUpEventFromWindow(thisDev, &core, grab->window, - None, TRUE); - if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, - grab->window, &core, 1) || - XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), - grab->window, &core, 1)) - deliveries = 1; /* don't send, but pretend we did */ - else if (!IsInterferingGrab(rClient(grab), thisDev, &core)) - { - deliveries = TryClientEvents(rClient(grab), thisDev, - &core, 1, mask, - filters[thisDev->id][core.u.u.type], - grab); - } + ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n"); + goto unwind; } - if (!deliveries) + FixUpEventFromWindow(thisDev, &core, grab->window, + None, TRUE); + if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, + grab->window, &core, 1) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), + grab->window, &core, 1)) + deliveries = 1; /* don't send, but pretend we did */ + else if (!IsInterferingGrab(rClient(grab), thisDev, &core)) { - /* try XI event */ - if (grabinfo->fromPassiveGrab && - grabinfo->implicitGrab) - mask = grab->deviceMask; - FixUpEventFromWindow(thisDev, xi, grab->window, - None, TRUE); - - if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, - grab->window, xi, count) || - XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), - grab->window, xi, count)) - deliveries = 1; /* don't send, but pretend we did */ - else - { - deliveries = - TryClientEvents(rClient(grab), thisDev, - xi, count, - mask, - filters[thisDev->id][xi->u.u.type], - grab); - } + deliveries = TryClientEvents(rClient(grab), thisDev, + &core, 1, mask, + filters[thisDev->id][core.u.u.type], + grab); + } + } + if (!deliveries) + { + /* try XI event */ + if (grabinfo->fromPassiveGrab && + grabinfo->implicitGrab) + mask = grab->deviceMask; + FixUpEventFromWindow(thisDev, xi, grab->window, + None, TRUE); + + if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, + grab->window, xi, count) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), + grab->window, xi, count)) + deliveries = 1; /* don't send, but pretend we did */ + else + { + deliveries = + TryClientEvents(rClient(grab), thisDev, + xi, count, + mask, + filters[thisDev->id][xi->u.u.type], + grab); } + } + if (deliveries && (event->u.any.type == ET_Motion)) thisDev->valuator->motionHintWindow = grab->window; } @@ -4377,7 +4256,6 @@ ProcGrabPointer(ClientPtr client) tempGrab.pointerMode = stuff->pointerMode; tempGrab.device = device; tempGrab.coreGrab = True; - tempGrab.genericMasks = NULL; (*device->deviceGrab.ActivateGrab)(device, &tempGrab, time, FALSE); if (oldCursor) FreeCursor (oldCursor, (Cursor)0); @@ -4554,7 +4432,6 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, tempGrab.device = dev; tempGrab.cursor = NULL; tempGrab.coreGrab = coreGrab; - tempGrab.genericMasks = NULL; (*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE); *status = GrabSuccess; @@ -5569,87 +5446,3 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event) return FALSE; } - -/** - * Set the filters for a extension. - * The filters array needs to contain the Masks that are applicable for each - * event type for the given extension. - * e.g. if generic event type 2 should be let through for windows with - * MyExampleMask set, make sure that filters[2] == MyExampleMask. - */ -void -SetGenericFilter(int extension, Mask* filters) -{ - generic_filters[extension & 0x7f] = filters; -} - - -/** - * Grab a device for XI events and XGE events. - * grabmode is used to ungrab a device. - */ -int -ExtGrabDevice(ClientPtr client, - DeviceIntPtr dev, - int device_mode, - WindowPtr grabWindow, - WindowPtr confineTo, - TimeStamp ctime, - Bool ownerEvents, - CursorPtr cursor, - Mask xi_mask, - GenericMaskPtr ge_masks) -{ - GrabInfoPtr grabinfo; - GrabRec newGrab; - - UpdateCurrentTime(); - - grabinfo = &dev->deviceGrab; - - if (grabinfo->grab && !SameClient(grabinfo->grab, client)) - return AlreadyGrabbed; - - if (!grabWindow->realized) - return GrabNotViewable; - - if ((CompareTimeStamps(ctime, currentTime) == LATER) || - (CompareTimeStamps(ctime, grabinfo->grabTime) == EARLIER)) - return GrabInvalidTime; - - if (grabinfo->sync.frozen && grabinfo->sync.other && - !SameClient(grabinfo->sync.other, client)) - return GrabFrozen; - - memset(&newGrab, 0, sizeof(GrabRec)); - newGrab.window = grabWindow; - newGrab.resource = client->clientAsMask; - newGrab.ownerEvents = ownerEvents; - newGrab.device = dev; - newGrab.cursor = cursor; - newGrab.confineTo = confineTo; - newGrab.eventMask = xi_mask; - newGrab.genericMasks = NULL; - newGrab.next = NULL; - - if (ge_masks) - { - newGrab.genericMasks = xcalloc(1, sizeof(GenericMaskRec)); - *newGrab.genericMasks = *ge_masks; - newGrab.genericMasks->next = NULL; - } - - if (IsPointerDevice(dev)) - { - newGrab.keyboardMode = GrabModeAsync; - newGrab.pointerMode = device_mode; - } else - { - newGrab.keyboardMode = device_mode; - newGrab.pointerMode = GrabModeAsync; - } - - (*grabinfo->ActivateGrab)(dev, &newGrab, ctime, FALSE); - return GrabSuccess; -} - diff --git a/dix/grabs.c b/dix/grabs.c index 142fc4a27..164e200ce 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -104,7 +104,6 @@ CreateGrab( grab->detail.pMask = NULL; grab->confineTo = confineTo; grab->cursor = cursor; - grab->genericMasks = NULL; grab->next = NULL; if (cursor) cursor->refcnt++; diff --git a/dix/window.c b/dix/window.c index e2669f0c5..55faaf05b 100644 --- a/dix/window.c +++ b/dix/window.c @@ -403,13 +403,6 @@ CreateRootWindow(ScreenPtr pScreen) pWin->optional->inputShape = NULL; pWin->optional->inputMasks = NULL; pWin->optional->deviceCursors = NULL; - pWin->optional->geMasks = (GenericClientMasksPtr)xcalloc(1, sizeof(GenericClientMasksRec)); - if (!pWin->optional->geMasks) - { - xfree(pWin->optional); - return FALSE; - } - pWin->optional->colormap = pScreen->defColormap; pWin->optional->visual = pScreen->rootVisual; @@ -792,8 +785,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, static void DisposeWindowOptional (WindowPtr pWin) { - GenericMaskPtr gmask = NULL, next = NULL; - if (!pWin->optional) return; /* @@ -824,17 +815,6 @@ DisposeWindowOptional (WindowPtr pWin) pWin->optional->deviceCursors = NULL; } - /* Remove generic event mask allocations */ - if (pWin->optional->geMasks) - gmask = pWin->optional->geMasks->geClients; - while(gmask) - { - next = gmask->next; - xfree(gmask); - gmask = next; - } - xfree (pWin->optional->geMasks); - xfree (pWin->optional); pWin->optional = NULL; } @@ -3443,9 +3423,6 @@ CheckWindowOptionalNeed (WindowPtr w) } } - if (optional->geMasks != NULL) - return; - parentOptional = FindWindowWithOptional(w)->optional; if (optional->visual != parentOptional->visual) return; @@ -3489,18 +3466,6 @@ MakeWindowOptional (WindowPtr pWin) optional->inputMasks = NULL; optional->deviceCursors = NULL; - optional->geMasks = xalloc(sizeof(GenericClientMasksRec)); - if (!optional->geMasks) - { - xfree(optional); - return FALSE; - } else { - int i; - optional->geMasks->geClients = 0; - for (i = 0; i < MAXEXTENSIONS; i++) - optional->geMasks->eventMasks[i] = 0; - } - parentOptional = FindWindowWithOptional(pWin)->optional; optional->visual = parentOptional->visual; if (!pWin->cursorIsNone) diff --git a/include/dix.h b/include/dix.h index 552a2d008..ebd8f2f62 100644 --- a/include/dix.h +++ b/include/dix.h @@ -611,16 +611,4 @@ extern _X_EXPORT ClientPtr LookupClient( XID id, ClientPtr client); -/* GE stuff */ -extern _X_EXPORT void SetGenericFilter(int extension, Mask* filters); -extern _X_EXPORT int ExtGrabDevice(ClientPtr client, - DeviceIntPtr dev, - int device_mode, - WindowPtr grabWindow, - WindowPtr confineTo, - TimeStamp ctime, - Bool ownerEvents, - CursorPtr cursor, - Mask xi_mask, - GenericMaskPtr ge_masks); #endif /* DIX_H */ diff --git a/include/inputstr.h b/include/inputstr.h index c9faaec13..3edd33f7d 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -175,7 +175,6 @@ typedef struct _GrabRec { CursorPtr cursor; /* always NULL for keyboards */ Mask eventMask; Mask deviceMask; - GenericMaskPtr genericMasks; } GrabRec; typedef struct _KeyClassRec { diff --git a/include/windowstr.h b/include/windowstr.h index 720803af7..be909b551 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -79,16 +79,6 @@ typedef struct _DevCursorNode { struct _DevCursorNode* next; } DevCursNodeRec, *DevCursNodePtr, *DevCursorList; -/* Mask structure for GE extension as stored on the window. - * Allows one mask per extension. - * .eventMask - Summary mask for all clients, used for quick checking. - * .geClients - list of clients with their specific mask. - */ -typedef struct _GenericClientMasks { - Mask eventMasks[MAXEXTENSIONS]; - GenericMaskPtr geClients; -} GenericClientMasksRec, *GenericClientMasksPtr; - typedef struct _WindowOpt { VisualID visual; /* default: same as parent */ CursorPtr cursor; /* default: window.cursorNone */ @@ -105,7 +95,6 @@ typedef struct _WindowOpt { RegionPtr inputShape; /* default: NULL */ struct _OtherInputMasks *inputMasks; /* default: NULL */ DevCursorList deviceCursors; /* default: NULL */ - struct _GenericClientMasks *geMasks; /* default: NULL */ } WindowOptRec, *WindowOptPtr; #define BackgroundPixel 2L |