summaryrefslogtreecommitdiff
path: root/Xi/queryst.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2006-02-20 22:16:49 +0000
committerAdam Jackson <ajax@nwnk.net>2006-02-20 22:16:49 +0000
commit6d7083bd69724586338d79784655328f1fcd2ae5 (patch)
tree59f85a0e3892d181bffc5dba78e040e91b838a27 /Xi/queryst.c
parent5480c537cee79b324736eac3e438a4713dfa1036 (diff)
indent fixes (OMG SO UGLY), and nuke old RCS keywords.
Diffstat (limited to 'Xi/queryst.c')
-rw-r--r--Xi/queryst.c139
1 files changed, 62 insertions, 77 deletions
diff --git a/Xi/queryst.c b/Xi/queryst.c
index d125e2de3..c4cc5a2e6 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -1,4 +1,3 @@
-/* $Xorg: queryst.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
/*
Copyright 1998, 1998 The Open Group
@@ -26,7 +25,6 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/programs/Xserver/Xi/queryst.c,v 3.4 2001/01/17 22:13:26 dawes Exp $ */
/***********************************************************************
*
@@ -40,14 +38,14 @@ from The Open Group.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
+#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -66,8 +64,8 @@ SProcXQueryDeviceState(register ClientPtr client)
REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length, n);
- return(ProcXQueryDeviceState(client));
- }
+ return (ProcXQueryDeviceState(client));
+}
/***********************************************************************
*
@@ -78,20 +76,20 @@ SProcXQueryDeviceState(register ClientPtr client)
int
ProcXQueryDeviceState(register ClientPtr client)
{
- register char n;
- int i;
- int num_classes = 0;
- int total_length = 0;
- char *buf, *savbuf;
- KeyClassPtr k;
- xKeyState *tk;
- ButtonClassPtr b;
- xButtonState *tb;
- ValuatorClassPtr v;
- xValuatorState *tv;
- xQueryDeviceStateReply rep;
- DeviceIntPtr dev;
- int *values;
+ register char n;
+ int i;
+ int num_classes = 0;
+ int total_length = 0;
+ char *buf, *savbuf;
+ KeyClassPtr k;
+ xKeyState *tk;
+ ButtonClassPtr b;
+ xButtonState *tb;
+ ValuatorClassPtr v;
+ xValuatorState *tv;
+ xQueryDeviceStateReply rep;
+ DeviceIntPtr dev;
+ int *values;
REQUEST(xQueryDeviceStateReq);
REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
@@ -101,96 +99,83 @@ ProcXQueryDeviceState(register ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- dev = LookupDeviceIntRec (stuff->deviceid);
- if (dev == NULL)
- {
- SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
- BadDevice);
+ dev = LookupDeviceIntRec(stuff->deviceid);
+ if (dev == NULL) {
+ SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice);
return Success;
- }
+ }
v = dev->valuator;
if (v != NULL && v->motionHintWindow != NULL)
MaybeStopDeviceHint(dev, client);
k = dev->key;
- if (k != NULL)
- {
- total_length += sizeof (xKeyState);
+ if (k != NULL) {
+ total_length += sizeof(xKeyState);
num_classes++;
- }
+ }
b = dev->button;
- if (b != NULL)
- {
- total_length += sizeof (xButtonState);
+ if (b != NULL) {
+ total_length += sizeof(xButtonState);
num_classes++;
- }
+ }
- if (v != NULL)
- {
- total_length += (sizeof(xValuatorState) +
- (v->numAxes * sizeof(int)));
+ if (v != NULL) {
+ total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
num_classes++;
- }
- buf = (char *) xalloc (total_length);
- if (!buf)
- {
- SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
- BadAlloc);
+ }
+ buf = (char *)xalloc(total_length);
+ if (!buf) {
+ SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc);
return Success;
- }
+ }
savbuf = buf;
- if (k != NULL)
- {
+ if (k != NULL) {
tk = (xKeyState *) buf;
tk->class = KeyClass;
- tk->length = sizeof (xKeyState);
+ tk->length = sizeof(xKeyState);
tk->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1;
- for (i = 0; i<32; i++)
+ for (i = 0; i < 32; i++)
tk->keys[i] = k->down[i];
- buf += sizeof (xKeyState);
- }
+ buf += sizeof(xKeyState);
+ }
- if (b != NULL)
- {
+ if (b != NULL) {
tb = (xButtonState *) buf;
tb->class = ButtonClass;
- tb->length = sizeof (xButtonState);
+ tb->length = sizeof(xButtonState);
tb->num_buttons = b->numButtons;
- for (i = 0; i<32; i++)
+ for (i = 0; i < 32; i++)
tb->buttons[i] = b->down[i];
- buf += sizeof (xButtonState);
- }
+ buf += sizeof(xButtonState);
+ }
- if (v != NULL)
- {
+ if (v != NULL) {
tv = (xValuatorState *) buf;
tv->class = ValuatorClass;
- tv->length = sizeof (xValuatorState);
+ tv->length = sizeof(xValuatorState);
tv->num_valuators = v->numAxes;
tv->mode = v->mode;
buf += sizeof(xValuatorState);
- for (i=0, values=v->axisVal; i<v->numAxes; i++)
- {
- *((int *) buf) = *values++;
- if (client->swapped)
- {
- swapl ((int *) buf, n);/* macro - braces needed */
- }
- buf += sizeof(int);
+ for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
+ *((int *)buf) = *values++;
+ if (client->swapped) {
+ swapl((int *)buf, n); /* macro - braces needed */
}
+ buf += sizeof(int);
}
+ }
rep.num_classes = num_classes;
rep.length = (total_length + 3) >> 2;
- WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
+ WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
- WriteToClient (client, total_length, savbuf);
- xfree (savbuf);
+ WriteToClient(client, total_length, savbuf);
+ xfree(savbuf);
return Success;
- }
+}
/***********************************************************************
*
@@ -200,11 +185,11 @@ ProcXQueryDeviceState(register ClientPtr client)
*/
void
-SRepXQueryDeviceState (ClientPtr client, int size, xQueryDeviceStateReply *rep)
+SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
register char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
- }
+}