diff options
-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)&& |