Xext: xtest.c: death to tabs+spaces indendation, remove #define XINPUT

This commit is contained in:
Peter Hutterer 2008-04-18 09:48:06 +09:30
parent eebdf69e9a
commit cb0168b4ac

View File

@ -1,30 +1,30 @@
/* /*
Copyright 1992, 1998 The Open Group Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting copyright notice and this permission notice appear in supporting
documentation. documentation.
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from The Open Group. from The Open Group.
*/ */
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
@ -45,17 +45,13 @@ from The Open Group.
#define _XTEST_SERVER_ #define _XTEST_SERVER_
#include <X11/extensions/XTest.h> #include <X11/extensions/XTest.h>
#include <X11/extensions/xteststr.h> #include <X11/extensions/xteststr.h>
#ifdef XINPUT
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#define EXTENSION_EVENT_BASE 64 #define EXTENSION_EVENT_BASE 64
#endif /* XINPUT */
#include "modinit.h" #include "modinit.h"
#ifdef XINPUT
extern int DeviceValuator; extern int DeviceValuator;
#endif /* XINPUT */
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiX.h" #include "panoramiX.h"
@ -64,11 +60,11 @@ extern int DeviceValuator;
static void XTestResetProc( static void XTestResetProc(
ExtensionEntry * /* extEntry */ ExtensionEntry * /* extEntry */
); );
static int XTestSwapFakeInput( static int XTestSwapFakeInput(
ClientPtr /* client */, ClientPtr /* client */,
xReq * /* req */ xReq * /* req */
); );
static DISPATCH_PROC(ProcXTestCompareCursor); static DISPATCH_PROC(ProcXTestCompareCursor);
static DISPATCH_PROC(ProcXTestDispatch); static DISPATCH_PROC(ProcXTestDispatch);
@ -92,7 +88,7 @@ XTestExtensionInit(INITARGS)
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
XTestResetProc (extEntry) XTestResetProc (extEntry)
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
{ {
} }
@ -165,12 +161,10 @@ ProcXTestFakeInput(client)
xEvent *ev; xEvent *ev;
DeviceIntPtr dev = NULL; DeviceIntPtr dev = NULL;
WindowPtr root; WindowPtr root;
#ifdef XINPUT
Bool extension = FALSE; Bool extension = FALSE;
deviceValuator *dv = NULL; deviceValuator *dv = NULL;
int base; int base;
int *values; int *values;
#endif /* XINPUT */
nev = (stuff->length << 2) - sizeof(xReq); nev = (stuff->length << 2) - sizeof(xReq);
if ((nev % sizeof(xEvent)) || !nev) if ((nev % sizeof(xEvent)) || !nev)
@ -179,7 +173,7 @@ ProcXTestFakeInput(client)
UpdateCurrentTime(); UpdateCurrentTime();
ev = (xEvent *)&((xReq *)stuff)[1]; ev = (xEvent *)&((xReq *)stuff)[1];
type = ev->u.u.type & 0177; type = ev->u.u.type & 0177;
#ifdef XINPUT
if (type >= EXTENSION_EVENT_BASE) if (type >= EXTENSION_EVENT_BASE)
{ {
type -= DeviceValuator; type -= DeviceValuator;
@ -197,7 +191,7 @@ ProcXTestFakeInput(client)
return BadValue; return BadValue;
} }
if (nev == 1 && type == XI_DeviceMotionNotify) if (nev == 1 && type == XI_DeviceMotionNotify)
return BadLength; return BadLength; /* DevMotion must be followed by DevValuator */
if (type == XI_DeviceMotionNotify) if (type == XI_DeviceMotionNotify)
base = ((deviceValuator *)(ev+1))->first_valuator; base = ((deviceValuator *)(ev+1))->first_valuator;
else else
@ -226,7 +220,6 @@ ProcXTestFakeInput(client)
extension = TRUE; extension = TRUE;
} }
else else
#endif /* XINPUT */
{ {
if (nev != 1) if (nev != 1)
return BadLength; return BadLength;
@ -243,6 +236,8 @@ ProcXTestFakeInput(client)
return BadValue; return BadValue;
} }
} }
/* If the event has a time set, wait for it to pass */
if (ev->u.keyButtonPointer.time) if (ev->u.keyButtonPointer.time)
{ {
TimeStamp activateTime; TimeStamp activateTime;
@ -271,7 +266,7 @@ ProcXTestFakeInput(client)
client->sequence--; client->sequence--;
return Success; return Success;
} }
#ifdef XINPUT
if (extension) if (extension)
{ {
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client, rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
@ -297,14 +292,11 @@ ProcXTestFakeInput(client)
} }
} }
} }
#endif /* XINPUT */
switch (type) switch (type)
{ {
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
#ifdef XINPUT
if (!extension) if (!extension)
#endif /* XINPUT */
dev = PickKeyboard(client); dev = PickKeyboard(client);
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode || if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode) ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
@ -314,7 +306,6 @@ ProcXTestFakeInput(client)
} }
break; break;
case MotionNotify: case MotionNotify:
#ifdef XINPUT
if (extension) if (extension)
{ {
if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue) if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue)
@ -322,6 +313,7 @@ ProcXTestFakeInput(client)
client->errorValue = ev->u.u.detail; client->errorValue = ev->u.u.detail;
return BadValue; return BadValue;
} }
/* detail is True for relative coordinates */
if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute) if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute)
{ {
values = dev->valuator->axisVal + dv->first_valuator; values = dev->valuator->axisVal + dv->first_valuator;
@ -348,7 +340,7 @@ ProcXTestFakeInput(client)
} }
break; break;
} }
#endif /* XINPUT */
if (!dev) if (!dev)
dev = PickPointer(client); dev = PickPointer(client);
if (ev->u.keyButtonPointer.root == None) if (ev->u.keyButtonPointer.root == None)
@ -437,9 +429,7 @@ ProcXTestFakeInput(client)
break; break;
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
#ifdef XINPUT
if (!extension) if (!extension)
#endif /* XINPUT */
dev = PickPointer(client); dev = PickPointer(client);
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
{ {