diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-11-03 11:30:48 +1030 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-11-04 16:04:16 +1030 |
commit | de1a8b68eb10c39a0d4a197107d68d7cc009edb2 (patch) | |
tree | 4acc1223eeee1f6afb256834a7d3c1eb70d19a05 | |
parent | d97239956667f8181f30271759573b75bf455fbb (diff) |
xkb: extract the correct device in XkbFilterEvents.
If the event is an XI event, we need to work on the correct device, not on
the VCK.
Adds XIGetDevice(event) function to extract the device from an event.
-rw-r--r-- | Xi/exevents.c | 32 | ||||
-rw-r--r-- | include/exevents.h | 2 | ||||
-rw-r--r-- | xkb/xkbEvents.c | 8 |
3 files changed, 42 insertions, 0 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 155cb9b52..c520c7dc7 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -134,6 +134,37 @@ IsPointerEvent(xEvent* xE) } /** + * @return the device matching the deviceid of the device set in the event, or + * NULL if the event is not an XInput event. + */ +DeviceIntPtr +XIGetDevice(xEvent* xE) +{ + DeviceIntPtr pDev = NULL; + + if (xE->u.u.type == DeviceButtonPress || + xE->u.u.type == DeviceButtonRelease || + xE->u.u.type == DeviceMotionNotify || + xE->u.u.type == DeviceEnterNotify || + xE->u.u.type == DeviceLeaveNotify || + xE->u.u.type == ProximityIn || + xE->u.u.type == ProximityOut || + xE->u.u.type == DevicePropertyNotify) + { + int rc; + int id; + + id = ((deviceKeyButtonPointer*)xE)->deviceid; + + rc = dixLookupDevice(&pDev, id, serverClient, DixUnknownAccess); + if (rc != Success) + ErrorF("[dix] XIGetDevice failed on XACE restrictions (%d)\n", rc); + } + return pDev; +} + + +/** * Copy the device->key into master->key and send a mapping notify to the * clients if appropriate. * master->key needs to be allocated by the caller. @@ -2107,3 +2138,4 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) FindInterestedChildren(dev, p1, mask, ev, count); } } + diff --git a/include/exevents.h b/include/exevents.h index 667004aa1..8788295bf 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -249,4 +249,6 @@ extern Atom XIGetKnownProperty( char* name ); +extern DeviceIntPtr XIGetDevice(xEvent *ev); + #endif /* EXEVENTS_H */ diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 335620baa..151849c70 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -37,6 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XIproto.h> #include "inputstr.h" #include "windowstr.h" +#include "exevents.h" #include <xkbsrv.h> #include "xkb.h" @@ -811,6 +812,13 @@ int i, button_mask; DeviceIntPtr pXDev = inputInfo.keyboard; XkbSrvInfoPtr xkbi; + if (xE->u.u.type & EXTENSION_EVENT_BASE) + { + pXDev = XIGetDevice(xE); + if (!pXDev) + pXDev = inputInfo.keyboard; + } + xkbi= pXDev->key->xkbInfo; if ( pClient->xkbClientFlags & _XkbClientInitialized ) { if ((xkbDebugFlags&0x10)&& |