diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-03 12:19:14 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-03 14:38:51 +1000 |
commit | eb3fe72cbcd10c3953d713e07c321e695194a328 (patch) | |
tree | f81760c6ec7282ef5c0d450260dbf0b98cd58f52 /dix/eventconvert.c | |
parent | 08fd2ae652883393ecff6f3d5177e63408d58472 (diff) |
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 <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r-- | dix/eventconvert.c | 12 |
1 files changed, 12 insertions, 0 deletions
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]; |