diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-09 16:36:07 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-20 15:17:56 +1000 |
commit | a668d91e28d5a3042a8ce0d087474883b046869a (patch) | |
tree | 33f25c4f0851becd59f3ecb68e964dd876aa0632 | |
parent | 32f338263ff7de1a2e76d570c98f5be979c18d4e (diff) |
dix: store the xi2mask on grabs and pass it around as needed.
This enables passive and implicit passive grabs for XI2 events, except that we
don't have the protocol spec yet to request them.
-rw-r--r-- | dix/events.c | 22 | ||||
-rw-r--r-- | dix/grabs.c | 2 | ||||
-rw-r--r-- | include/inputstr.h | 2 |
3 files changed, 23 insertions, 3 deletions
diff --git a/dix/events.c b/dix/events.c index 52729cad6..d4eea2c44 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2040,7 +2040,8 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent * Note that since core events are delivered first, an implicit grab may * be activated on a core grab, stopping the XI events. */ - if ((type == DeviceButtonPress || type == ButtonPress) + if ((type == DeviceButtonPress || type == ButtonPress || + ((XI2_EVENT(pEvents) && ((xGenericEvent*)pEvents)->evtype == XI_ButtonPress))) && deliveries && (!grab)) { @@ -2059,10 +2060,14 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent tempGrab.cursor = NullCursor; tempGrab.coreGrab = (type == ButtonPress); - /* get the XI device mask */ + /* get the XI and XI2 device mask */ inputMasks = wOtherInputMasks(pWin); tempGrab.deviceMask = (inputMasks) ? inputMasks->inputEvents[pDev->id]: 0; + if (inputMasks) + memcpy(tempGrab.xi2mask, inputMasks->xi2mask, + sizeof(tempGrab.xi2mask)); + (*pDev->deviceGrab.ActivateGrab)(pDev, &tempGrab, currentTime, TRUE | ImplicitGrabMask); } @@ -3697,6 +3702,19 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, if (!deliveries) { + int evtype = ((xGenericEvent*)xi2)->evtype; + mask = grab->xi2mask[AllDevices][evtype/8] | + grab->xi2mask[AllMasterDevices][evtype/8] | + grab->xi2mask[thisDev->id][evtype/8]; + /* try XI2 event */ + FixUpEventFromWindow(thisDev, xi2, grab->window, None, TRUE); + /* XXX: XACE */ + deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask, + GetEventFilter(thisDev, xi2), grab); + } + + if (!deliveries) + { /* try XI event */ if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab) diff --git a/dix/grabs.c b/dix/grabs.c index 164e200ce..156574efe 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -82,7 +82,7 @@ CreateGrab( { GrabPtr grab; - grab = xalloc(sizeof(GrabRec)); + grab = xcalloc(1, sizeof(GrabRec)); if (!grab) return (GrabPtr)NULL; grab->resource = FakeClientID(client); diff --git a/include/inputstr.h b/include/inputstr.h index 678c171c5..59fb29bf0 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -181,6 +181,8 @@ typedef struct _GrabRec { CursorPtr cursor; /* always NULL for keyboards */ Mask eventMask; Mask deviceMask; + /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; } GrabRec; typedef struct _KeyClassRec { |