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>
This commit is contained in:
Peter Hutterer 2009-05-01 15:22:37 +10:00
parent 0fdff0a47a
commit 226dd90597

View File

@ -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;