From eb3fe72cbcd10c3953d713e07c321e695194a328 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 3 Jun 2009 12:19:14 +1000 Subject: dix: set the device state for XI valuator events. Valuator events need to include the device's state, while other device events need to include the state of the core devices. Reported-by: Thomas Jaeger Signed-off-by: Peter Hutterer --- dix/eventconvert.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'dix/eventconvert.c') diff --git a/dix/eventconvert.c b/dix/eventconvert.c index fa2684c0d..85ddd61f2 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -46,6 +46,7 @@ #include "exglobals.h" #include "eventconvert.h" #include "querydev.h" +#include "xkbsrv.h" static int countValuators(DeviceEvent *ev, int *first); @@ -279,9 +280,19 @@ static int getValuatorEvents(DeviceEvent *ev, deviceValuator *xv) { int i; + int state = 0; int first_valuator, num_valuators; + num_valuators = countValuators(ev, &first_valuator); + if (num_valuators > 0) + { + DeviceIntPtr dev = NULL; + dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess); + /* State needs to be assembled BEFORE the device is updated. */ + state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0; + state |= (dev && dev->button) ? (dev->button->state) : 0; + } /* FIXME: non-continuous valuator data in internal events*/ for (i = 0; i < num_valuators; i += 6, xv++) { @@ -289,6 +300,7 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv) xv->first_valuator = first_valuator + i; xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i); xv->deviceid = ev->deviceid; + xv->device_state = state; switch (xv->num_valuators) { case 6: xv->valuator5 = ev->valuators.data[i + 5]; -- cgit v1.2.3