summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-05-01 15:22:37 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-05 14:12:04 +1000
commit14d5471981151b27678de826daa078977217477a (patch)
tree756cbfab8b204be3063b689f61b2be278a18cba2 /Xext
parentf1bed0959e803784af142a0f45177ee3b675d78a (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.c10
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;