diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-01 15:22:37 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-04 15:21:39 +1000 |
commit | 226dd90597ef29998ac5db15c5457aad3fe9729e (patch) | |
tree | e68bb5fe7c1a9b1f1854470f2bda4663b1d64ae8 /Xext | |
parent | 0fdff0a47a57a0096974ee83e07fefbad03075dd (diff) |
Xext: return BadDevice from XTest if we don't have keys/buttons/valuators.
BadDevice is an XI error, but this cannot happen for core XTest fake input
anyway since the device will be the matching virtual XTest slave device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/xtest.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c index 8aca6a0f7..cb32c2858 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -49,6 +49,7 @@ #include <X11/extensions/xteststr.h> #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> +#include "exglobals.h" #include "modinit.h" @@ -342,6 +343,9 @@ ProcXTestFakeInput(ClientPtr client) { case KeyPress: case KeyRelease: + if (!dev->key) + return BadDevice; + if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code || ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code) { @@ -350,6 +354,9 @@ ProcXTestFakeInput(ClientPtr client) } break; case MotionNotify: + if (!dev->valuator) + return BadDevice; + /* broken lib, XI events have root uninitialized */ if (extension || ev->u.keyButtonPointer.root == None) root = GetCurrentRootWindow(dev); @@ -376,6 +383,9 @@ ProcXTestFakeInput(ClientPtr client) break; case ButtonPress: case ButtonRelease: + if (!dev->button) + return BadDevice; + if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) { client->errorValue = ev->u.u.detail; |