summaryrefslogtreecommitdiff
path: root/xc/lib/Xi
diff options
context:
space:
mode:
authorrws <empty>1991-07-16 16:39:46 +0000
committerrws <empty>1991-07-16 16:39:46 +0000
commit9536782072027954e9c0ad789805ae81c88d05bc (patch)
treedfe5a5083cd5d0af8198e963f9e00b1ea0bbc12b /xc/lib/Xi
parentc397a48b57c586a6cd6fd2147c92f762cc102010 (diff)
redo valuator assignments to avoid taking address of bitfield on Cray
Diffstat (limited to 'xc/lib/Xi')
-rw-r--r--xc/lib/Xi/XExtInt.c83
-rw-r--r--xc/lib/Xi/XExtToWire.c77
2 files changed, 112 insertions, 48 deletions
diff --git a/xc/lib/Xi/XExtInt.c b/xc/lib/Xi/XExtInt.c
index a03756a28..34f996dbd 100644
--- a/xc/lib/Xi/XExtInt.c
+++ b/xc/lib/Xi/XExtInt.c
@@ -1,4 +1,4 @@
-/* $Header: XExtInt.c,v 1.18 91/05/08 10:29:37 rws Exp $ */
+/* $Header: XExtInt.c,v 1.19 91/05/12 18:39:58 rws Exp $ */
/************************************************************
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California, and the
@@ -349,7 +349,6 @@ XInputWireToEvent (dpy, re, event)
{
deviceValuator *xev = (deviceValuator *) event;
int save_type = save->type - info->codes->first_event;
- INT32 *ip /* B32 */ = &xev->valuator0;
if (save_type == XI_DeviceKeyPress ||
save_type == XI_DeviceKeyRelease)
@@ -358,9 +357,17 @@ XInputWireToEvent (dpy, re, event)
kev->device_state = xev->device_state;
kev->axes_count = xev->num_valuators;
kev->first_axis = xev->first_valuator;
- kev->axes_count = xev->num_valuators;
- for (i=0; i<xev->num_valuators && i<6; i++)
- kev->axis_data[i] = *(ip + i);
+ i = xev->num_valuators;
+ if (i > 6) i = 6;
+ switch (i)
+ {
+ case 6: kev->axis_data[5] = xev->valuator5;
+ case 5: kev->axis_data[4] = xev->valuator4;
+ case 4: kev->axis_data[3] = xev->valuator3;
+ case 3: kev->axis_data[2] = xev->valuator2;
+ case 2: kev->axis_data[1] = xev->valuator1;
+ case 1: kev->axis_data[0] = xev->valuator0;
+ }
}
else if (save_type == XI_DeviceButtonPress ||
save_type == XI_DeviceButtonRelease)
@@ -369,9 +376,17 @@ XInputWireToEvent (dpy, re, event)
bev->device_state = xev->device_state;
bev->axes_count = xev->num_valuators;
bev->first_axis = xev->first_valuator;
- bev->axes_count = xev->num_valuators;
- for (i=0; i<xev->num_valuators && i<6; i++)
- bev->axis_data[i] = *(ip + i);
+ i = xev->num_valuators;
+ if (i > 6) i = 6;
+ switch (i)
+ {
+ case 6: bev->axis_data[5] = xev->valuator5;
+ case 5: bev->axis_data[4] = xev->valuator4;
+ case 4: bev->axis_data[3] = xev->valuator3;
+ case 3: bev->axis_data[2] = xev->valuator2;
+ case 2: bev->axis_data[1] = xev->valuator1;
+ case 1: bev->axis_data[0] = xev->valuator0;
+ }
}
else if (save_type == XI_DeviceMotionNotify)
{
@@ -379,9 +394,17 @@ XInputWireToEvent (dpy, re, event)
mev->device_state = xev->device_state;
mev->axes_count = xev->num_valuators;
mev->first_axis = xev->first_valuator;
- mev->axes_count = xev->num_valuators;
- for (i=0; i<xev->num_valuators && i<6; i++)
- mev->axis_data[i] = *(ip + i);
+ i = xev->num_valuators;
+ if (i > 6) i = 6;
+ switch (i)
+ {
+ case 6: mev->axis_data[5] = xev->valuator5;
+ case 5: mev->axis_data[4] = xev->valuator4;
+ case 4: mev->axis_data[3] = xev->valuator3;
+ case 3: mev->axis_data[2] = xev->valuator2;
+ case 2: mev->axis_data[1] = xev->valuator1;
+ case 1: mev->axis_data[0] = xev->valuator0;
+ }
}
else if (save_type == XI_ProximityIn ||
save_type == XI_ProximityOut)
@@ -391,9 +414,17 @@ XInputWireToEvent (dpy, re, event)
pev->device_state = xev->device_state;
pev->axes_count = xev->num_valuators;
pev->first_axis = xev->first_valuator;
- pev->axes_count = xev->num_valuators;
- for (i=0; i<xev->num_valuators && i<6; i++)
- pev->axis_data[i] = *(ip + i);
+ i = xev->num_valuators;
+ if (i > 6) i = 6;
+ switch (i)
+ {
+ case 6: pev->axis_data[5] = xev->valuator5;
+ case 5: pev->axis_data[4] = xev->valuator4;
+ case 4: pev->axis_data[3] = xev->valuator3;
+ case 3: pev->axis_data[2] = xev->valuator2;
+ case 2: pev->axis_data[1] = xev->valuator1;
+ case 1: pev->axis_data[0] = xev->valuator0;
+ }
}
else if (save_type == XI_DeviceStateNotify)
{
@@ -406,12 +437,19 @@ XInputWireToEvent (dpy, re, event)
if (any->class != ValuatorClass)
any = (XInputClass *) ((char *) any + any->length);
v = (XValuatorStatus *) any;
- for (i=v->num_valuators,j=0;
- i<6 && j<xev->num_valuators; i++,j++)
+ i = v->num_valuators;
+ j = xev->num_valuators;
+ if (j > 6) j = 6;
+ switch (j)
{
- v->valuators[i] = *(ip + j);
+ case 6: v->valuators[i + 5] = xev->valuator5;
+ case 5: v->valuators[i + 4] = xev->valuator4;
+ case 4: v->valuators[i + 3] = xev->valuator3;
+ case 3: v->valuators[i + 2] = xev->valuator2;
+ case 2: v->valuators[i + 1] = xev->valuator1;
+ case 1: v->valuators[i + 0] = xev->valuator0;
}
- v->num_valuators += xev->num_valuators;
+ v->num_valuators += j;
}
*re = *save;
@@ -443,7 +481,6 @@ XInputWireToEvent (dpy, re, event)
XButtonStatus *bev;
XValuatorStatus *vev;
char *data;
- INT32 *ip /* B32 */ = &sev->valuator0;
stev->window = dpy->current;
stev->deviceid = sev->deviceid & DEVICE_BITS;
@@ -474,8 +511,12 @@ XInputWireToEvent (dpy, re, event)
vev->class = ValuatorClass;
vev->length = sizeof (XValuatorStatus);
vev->num_valuators = sev->num_valuators;
- for (i=0; i<sev->num_valuators; i++)
- vev->valuators[i] = *(ip + i);
+ switch (sev->num_valuators)
+ {
+ case 3: vev->valuators[2] = sev->valuator2;
+ case 2: vev->valuators[1] = sev->valuator1;
+ case 1: vev->valuators[0] = sev->valuator0;
+ }
data += sizeof (XValuatorStatus);
}
if (sev->deviceid & MORE_EVENTS)
diff --git a/xc/lib/Xi/XExtToWire.c b/xc/lib/Xi/XExtToWire.c
index b8138e6f5..618b22ae8 100644
--- a/xc/lib/Xi/XExtToWire.c
+++ b/xc/lib/Xi/XExtToWire.c
@@ -1,4 +1,4 @@
-/* $Header: XExtToWire.c,v 1.9 91/02/09 17:50:32 rws Exp $ */
+/* $Header: XExtToWire.c,v 1.10 91/05/12 18:39:07 rws Exp $ */
/************************************************************
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California, and the
@@ -44,7 +44,6 @@ XInputEventToWire(dpy, re, event, count)
register xEvent **event; /* wire protocol event */
register int *count;
{
- int i;
XExtDisplayInfo *info = (XExtDisplayInfo *) XInput_find_display (dpy);
switch ((re->type & 0x7f) - info->codes->first_event)
@@ -55,7 +54,6 @@ XInputEventToWire(dpy, re, event, count)
register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) re;
register deviceKeyButtonPointer *kev;
register deviceValuator *vev;
- INT32 *ip /* B32 */;
*count = 2;
kev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
@@ -86,9 +84,15 @@ XInputEventToWire(dpy, re, event, count)
vev->device_state = ev->device_state;
vev->first_valuator = 0;
vev->num_valuators = ev->axes_count;
- ip = &vev->valuator0;
- for (i=0; i<(int)vev->num_valuators; i++)
- *(ip+i) = ev->axis_data[i];
+ switch (vev->num_valuators)
+ {
+ case 6: vev->valuator5 = ev->axis_data[5];
+ case 5: vev->valuator4 = ev->axis_data[4];
+ case 4: vev->valuator3 = ev->axis_data[3];
+ case 3: vev->valuator2 = ev->axis_data[2];
+ case 2: vev->valuator1 = ev->axis_data[1];
+ case 1: vev->valuator0 = ev->axis_data[0];
+ }
}
break;
}
@@ -99,7 +103,6 @@ XInputEventToWire(dpy, re, event, count)
(XProximityNotifyEvent *) re;
register deviceKeyButtonPointer *pev;
register deviceValuator *vev;
- INT32 *ip /* B32 */;
*count = 2;
pev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
@@ -129,9 +132,15 @@ XInputEventToWire(dpy, re, event, count)
vev->device_state = ev->device_state;
vev->first_valuator = 0;
vev->num_valuators = ev->axes_count;
- ip = &vev->valuator0;
- for (i=0; i<(int)vev->num_valuators; i++)
- *(ip+i) = ev->axis_data[i];
+ switch (vev->num_valuators)
+ {
+ case 6: vev->valuator5 = ev->axis_data[5];
+ case 5: vev->valuator4 = ev->axis_data[4];
+ case 4: vev->valuator3 = ev->axis_data[3];
+ case 3: vev->valuator2 = ev->axis_data[2];
+ case 2: vev->valuator1 = ev->axis_data[1];
+ case 1: vev->valuator0 = ev->axis_data[0];
+ }
}
break;
}
@@ -142,7 +151,6 @@ XInputEventToWire(dpy, re, event, count)
(XDeviceButtonEvent *) re;
register deviceKeyButtonPointer *bev;
register deviceValuator *vev;
- INT32 *ip /* B32 */;
*count = 2;
bev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
@@ -173,9 +181,15 @@ XInputEventToWire(dpy, re, event, count)
vev->device_state = ev->device_state;
vev->first_valuator = 0;
vev->num_valuators = ev->axes_count;
- ip = &vev->valuator0;
- for (i=0; i<(int)vev->num_valuators; i++)
- *(ip+i) = ev->axis_data[i];
+ switch (vev->num_valuators)
+ {
+ case 6: vev->valuator5 = ev->axis_data[5];
+ case 5: vev->valuator4 = ev->axis_data[4];
+ case 4: vev->valuator3 = ev->axis_data[3];
+ case 3: vev->valuator2 = ev->axis_data[2];
+ case 2: vev->valuator1 = ev->axis_data[1];
+ case 1: vev->valuator0 = ev->axis_data[0];
+ }
}
break;
}
@@ -185,7 +199,6 @@ XInputEventToWire(dpy, re, event, count)
(XDeviceMotionEvent *)re;
register deviceKeyButtonPointer *mev;
register deviceValuator *vev;
- INT32 *ip /* B32 */;
*count = 2;
mev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
@@ -216,9 +229,15 @@ XInputEventToWire(dpy, re, event, count)
vev->device_state = ev->device_state;
vev->first_valuator = 0;
vev->num_valuators = ev->axes_count;
- ip = &vev->valuator0;
- for (i=0; i<(int)vev->num_valuators; i++)
- *(ip+i) = ev->axis_data[i];
+ switch (vev->num_valuators)
+ {
+ case 6: vev->valuator5 = ev->axis_data[5];
+ case 5: vev->valuator4 = ev->axis_data[4];
+ case 4: vev->valuator3 = ev->axis_data[3];
+ case 3: vev->valuator2 = ev->axis_data[2];
+ case 2: vev->valuator1 = ev->axis_data[1];
+ case 1: vev->valuator0 = ev->axis_data[0];
+ }
}
break;
}
@@ -270,7 +289,7 @@ XInputEventToWire(dpy, re, event, count)
register xEvent *tev;
XInputClass *any = (XInputClass *) &ev->data[0];
unsigned char *sav_id;
-
+ int i;
*count = 1;
for (i=0; i<ev->num_classes; i++)
@@ -353,17 +372,18 @@ XInputEventToWire(dpy, re, event, count)
}
else if (any->class == ValuatorClass)
{
- int j;
- INT32 *ip /* B32 */;
XValuatorStatus *val = (XValuatorStatus *) any;
register deviceValuator *vev;
sev->classes_reported |= (1 << ValuatorClass);
sev->num_valuators = val->num_valuators < 3 ?
val->num_valuators : 3;
- ip = (INT32 *) &sev->valuator0;
- for (j=0; j<(int)val->num_valuators && j<3; j++)
- *(ip+j) = val->valuators[j];
+ switch (sev->num_valuators)
+ {
+ case 3: sev->valuator2 = val->valuators[2];
+ case 2: sev->valuator1 = val->valuators[1];
+ case 1: sev->valuator0 = val->valuators[0];
+ }
if (val->num_valuators > 3)
{
vev = (deviceValuator *) tev++;
@@ -374,9 +394,12 @@ XInputEventToWire(dpy, re, event, count)
vev->num_valuators = val->num_valuators - 3;
*sav_id |= MORE_EVENTS;
sav_id = &(vev->deviceid);
- ip = &vev->valuator0;
- for (j=3; j<(int)val->num_valuators; j++)
- *(ip+j-3) = val->valuators[j];
+ switch (val->num_valuators)
+ {
+ case 6: sev->valuator2 = val->valuators[5];
+ case 5: sev->valuator1 = val->valuators[4];
+ case 4: sev->valuator0 = val->valuators[3];
+ }
}
}
any = (XInputClass *) ((char *) any + any->length);