Commit 41a0ba72 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mihai Moldovan

Xi: reformat code, ansify

parent 5bfafee5
......@@ -77,13 +77,13 @@ SOFTWARE.
int
SProcXAllowDeviceEvents(client)
register ClientPtr client;
{
{
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return(ProcXAllowDeviceEvents(client));
}
return (ProcXAllowDeviceEvents(client));
}
/***********************************************************************
*
......@@ -94,46 +94,46 @@ SProcXAllowDeviceEvents(client)
int
ProcXAllowDeviceEvents(client)
register ClientPtr client;
{
TimeStamp time;
DeviceIntPtr thisdev;
{
TimeStamp time;
DeviceIntPtr thisdev;
REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
thisdev = LookupDeviceIntRec (stuff->deviceid);
thisdev = LookupDeviceIntRec(stuff->deviceid);
if (thisdev == NULL)
{
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
return Success;
}
}
time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode)
{
case ReplayThisDevice:
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
case ReplayThisDevice:
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0,
BadValue);
client->errorValue = stuff->mode;
return Success;
}
return Success;
client->errorValue = stuff->mode;
return Success;
}
return Success;
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXAllowDeviceEvents(
ClientPtr /* client */
);
);
int
ProcXAllowDeviceEvents(
ClientPtr /* client */
);
);
#endif /* ALLOWEV_H */
......@@ -78,13 +78,13 @@ SOFTWARE.
int
SProcXChangeDeviceControl(client)
register ClientPtr client;
{
{
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control);
return(ProcXChangeDeviceControl(client));
}
return (ProcXChangeDeviceControl(client));
}
/***********************************************************************
*
......@@ -95,7 +95,7 @@ SProcXChangeDeviceControl(client)
int
ProcXChangeDeviceControl(client)
ClientPtr client;
{
{
unsigned len;
int i, status;
DeviceIntPtr dev;
......@@ -107,14 +107,14 @@ ProcXChangeDeviceControl(client)
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
len = stuff->length - (sizeof(xChangeDeviceControlReq) >>2);
dev = LookupDeviceIntRec (stuff->deviceid);
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadDevice);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_ChangeDeviceControl;
......@@ -123,73 +123,73 @@ ProcXChangeDeviceControl(client)
switch (stuff->control)
{
case DEVICE_RESOLUTION:
r = (xDeviceResolutionCtl *) &stuff[1];
if ((len < (sizeof(xDeviceResolutionCtl)>>2)) ||
case DEVICE_RESOLUTION:
r = (xDeviceResolutionCtl *) & stuff[1];
if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) ||
(len != (sizeof(xDeviceResolutionCtl)>>2) +
r->num_valuators))
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl,
0, BadLength);
return Success;
}
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl,
0, BadLength);
return Success;
}
if (!dev->valuator)
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
}
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
}
if ((dev->grab) && !SameClient(dev->grab, client))
{
rep.status = AlreadyGrabbed;
rep.status = AlreadyGrabbed;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
}
resolution = (CARD32 *) (r + 1);
return Success;
}
resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes)
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
return Success;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r);
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
return Success;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success)
{
a = &dev->valuator->axes[r->first_valuator];
for (i=0; i<r->num_valuators; i++)
if (*(resolution+i) < (a+i)->min_resolution ||
a = &dev->valuator->axes[r->first_valuator];
for (i = 0; i < r->num_valuators; i++)
if (*(resolution + i) < (a + i)->min_resolution ||
*(resolution+i) > (a+i)->max_resolution)
{
SendErrorToClient (client, IReqCode,
X_ChangeDeviceControl, 0, BadValue);
return Success;
}
for (i=0; i<r->num_valuators; i++)
(a++)->resolution = *resolution++;
SendErrorToClient(client, IReqCode,
X_ChangeDeviceControl, 0, BadValue);
return Success;
}
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
}
else if (status == DeviceBusy)
{
rep.status = DeviceBusy;
rep.status = DeviceBusy;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
return Success;
}
else
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
}
break;
default:
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
}
break;
default:
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
return Success;
}
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
return Success;
}
}
/***********************************************************************
*
......@@ -203,9 +203,9 @@ SRepXChangeDeviceControl (client, size, rep)
ClientPtr client;
int size;
xChangeDeviceControlReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXChangeDeviceControl(
ClientPtr /* client */
);
);
int
ProcXChangeDeviceControl(
ClientPtr /* client */
);
);
void
SRepXChangeDeviceControl (
ClientPtr /* client */,
int /* size */,
xChangeDeviceControlReply * /* rep */
);
int /* size */ ,
xChangeDeviceControlReply * /* rep */
);
#endif /* CHGDCTL_H */
......@@ -79,13 +79,13 @@ SOFTWARE.
int
SProcXChangeFeedbackControl(client)
register ClientPtr client;
{
{
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return(ProcXChangeFeedbackControl(client));
}
return (ProcXChangeFeedbackControl(client));
}
/***********************************************************************
*
......@@ -96,7 +96,7 @@ SProcXChangeFeedbackControl(client)
int
ProcXChangeFeedbackControl(client)
ClientPtr client;
{
{
unsigned len;
DeviceIntPtr dev;
KbdFeedbackPtr k;
......@@ -109,117 +109,117 @@ ProcXChangeFeedbackControl(client)
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >>2);
dev = LookupDeviceIntRec (stuff->deviceid);
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadDevice);
return Success;
}
}
switch (stuff->feedbackid)
{
case KbdFeedbackClass:
case KbdFeedbackClass:
if (len != (sizeof(xKbdFeedbackCtl)>>2))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (k=dev->kbdfeed; k; k=k->next)
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (k = dev->kbdfeed; k; k = k->next)
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
{
ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]);
return Success;
}
break;
case PtrFeedbackClass:
return Success;
}
break;
case PtrFeedbackClass:
if (len != (sizeof(xPtrFeedbackCtl)>>2))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (p=dev->ptrfeed; p; p=p->next)
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (p = dev->ptrfeed; p; p = p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
{
ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]);
return Success;
}
break;
case StringFeedbackClass:
{
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
return Success;
}
break;
case StringFeedbackClass:
{
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
if (client->swapped)
{
if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2)
return BadLength;
swaps(&f->num_keysyms);
}
if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2)
return BadLength;
swaps(&f->num_keysyms);
}
if (len != ((sizeof(xStringFeedbackCtl)>>2) + f->num_keysyms))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (s=dev->stringfeed; s; s=s->next)
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (s = dev->stringfeed; s; s = s->next)
if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
{
ChangeStringFeedback (client, dev, stuff->mask,s,(xStringFeedbackCtl *)&stuff[1]);
return Success;
}
break;
return Success;
}
case IntegerFeedbackClass:
break;
}
case IntegerFeedbackClass:
if (len != (sizeof(xIntegerFeedbackCtl)>>2))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (i=dev->intfeed; i; i=i->next)
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (i = dev->intfeed; i; i = i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
{
ChangeIntegerFeedback (client, dev,stuff->mask,i,(xIntegerFeedbackCtl *)&stuff[1]);
return Success;
}
break;
case LedFeedbackClass:
return Success;
}
break;
case LedFeedbackClass:
if (len != (sizeof(xLedFeedbackCtl)>>2))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (l=dev->leds; l; l=l->next)
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (l = dev->leds; l; l = l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
{
ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]);
return Success;
}
break;
case BellFeedbackClass:
return Success;
}
break;
case BellFeedbackClass:
if (len != (sizeof(xBellFeedbackCtl)>>2))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (b=dev->bell; b; b=b->next)
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
for (b = dev->bell; b; b = b->next)
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
{
ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]);
return Success;
}
break;
default:
break;
}
return Success;
}
break;
default:
break;
}
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
return Success;
}
}
/******************************************************************************
*
......@@ -234,7 +234,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
unsigned long mask;
KbdFeedbackPtr k;
xKbdFeedbackCtl *f;
{
{
KeybdCtrl kctrl;
int t;
int key = DO_ALL;
......@@ -246,7 +246,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
swaps(&f->duration);
swapl(&f->led_mask);
swapl(&f->led_values);
}
}
kctrl = k->ctrl;
if (mask & DvKeyClickPercent)
......@@ -257,12 +257,12 @@ ChangeKbdFeedback (client, dev, mask, k, f)
else if (t < 0 || t > 100)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
}
kctrl.click = t;
}
}
if (mask & DvPercent)
{
......@@ -272,12 +272,12 @@ ChangeKbdFeedback (client, dev, mask, k, f)
else if (t < 0 || t > 100)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
kctrl.bell = t;
}
kctrl.bell = t;
}
if (mask & DvPitch)
{
......@@ -287,12 +287,12 @@ ChangeKbdFeedback (client, dev, mask, k, f)
else if (t < 0)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
kctrl.bell_pitch = t;
}
kctrl.bell_pitch = t;
}
if (mask & DvDuration)
{
......@@ -302,18 +302,18 @@ ChangeKbdFeedback (client, dev, mask, k, f)
else if (t < 0)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
}
kctrl.bell_duration = t;
}
}
if (mask & DvLed)
{
kctrl.leds &= ~(f->led_mask);
kctrl.leds |= (f->led_mask & f->led_values);
}
}
if (mask & DvKey)
{
......@@ -321,17 +321,17 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (key < 8 || key > 255)
{
client->errorValue = key;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
}
if (!(mask & DvAutoRepeatMode))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadMatch);
return Success;
}
}
}
if (mask & DvAutoRepeatMode)
{
......@@ -365,16 +365,16 @@ ChangeKbdFeedback (client, dev, mask, k, f)
else
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
}
}
}
k->ctrl = kctrl;
(*k->CtrlProc)(dev, &k->ctrl);
(*k->CtrlProc) (dev, &k->ctrl);
return Success;
}
}
/******************************************************************************
*
......@@ -389,8 +389,8 @@ ChangePtrFeedback (client, dev, mask, p, f)
unsigned long mask;
PtrFeedbackPtr p;
xPtrFeedbackCtl *f;
{
PtrCtrl pctrl; /* might get BadValue part way through */
{
PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped)
{
......@@ -398,12 +398,12 @@ ChangePtrFeedback (client, dev, mask, p, f)
swaps(&f->num);
swaps(&f->denom);
swaps(&f->thresh);
}
}
pctrl = p->ctrl;
if (mask & DvAccelNum)
{
int accelNum;
int accelNum;
accelNum = f->num;
if (accelNum == -1)
......@@ -411,16 +411,16 @@ ChangePtrFeedback (client, dev, mask, p, f)
else if (accelNum < 0)
{
client->errorValue = accelNum;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
else pctrl.num = accelNum;
}
}
if (mask & DvAccelDenom)
{
int accelDenom;
int accelDenom;
accelDenom = f->denom;
if (accelDenom == -1)
......@@ -428,16 +428,16 @@ ChangePtrFeedback (client, dev, mask, p, f)
else if (accelDenom <= 0)
{
client->errorValue = accelDenom;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
else pctrl.den = accelDenom;
}
}
if (mask & DvThreshold)
{
int threshold;
int threshold;
threshold = f->thresh;
if (threshold == -1)
......@@ -445,17 +445,17 @@ ChangePtrFeedback (client, dev, mask, p, f)
else if (threshold < 0)
{
client->errorValue = threshold;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
else pctrl.threshold = threshold;
}
}
p->ctrl = pctrl;
(*p->CtrlProc)(dev, &p->ctrl);
(*p->CtrlProc) (dev, &p->ctrl);
return Success;
}
}
/******************************************************************************
*
......@@ -472,15 +472,15 @@ ChangeIntegerFeedback (client, dev, mask, i, f)
xIntegerFeedbackCtl *f;
{
if (client->swapped)
{
{
swaps(&f->length);
swapl(&f->int_to_display);
}
}
i->ctrl.integer_displayed = f->int_to_display;
(*i->CtrlProc)(dev, &i->ctrl);
(*i->CtrlProc) (dev, &i->ctrl);
return Success;
}
}
/******************************************************************************
*
......@@ -495,43 +495,43 @@ ChangeStringFeedback (client, dev, mask, s, f)
unsigned long mask;
StringFeedbackPtr s;
xStringFeedbackCtl *f;
{
int i, j;
KeySym *syms, *sup_syms;
{
int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f+1);
syms = (KeySym *) (f + 1);
if (client->swapped)
{
swaps(&f->length); /* swapped num_keysyms in calling proc */
SwapLongs((CARD32 *) syms, f->num_keysyms);
}
}
if (f->num_keysyms > s->ctrl.max_symbols)
{
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
}
sup_syms = s->ctrl.symbols_supported;
for (i=0; i<f->num_keysyms; i++)
{
for (j=0; j<s->ctrl.num_symbols_supported; j++)
if (*(syms+i) == *(sup_syms+j))
for (j = 0; j < s->ctrl.num_symbols_supported; j++)
if (*(syms + i) == *(sup_syms + j))
break;
if (j==s->ctrl.num_symbols_supported)
{
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadMatch);
return Success;
}
}
}
s->ctrl.num_symbols_displayed = f->num_keysyms;
for (i=0; i<f->num_keysyms; i++)
*(s->ctrl.symbols_displayed+i) = *(syms+i);
(*s->CtrlProc)(dev, &s->ctrl);
s->ctrl.num_symbols_displayed = f->num_keysyms;
for (i = 0; i < f->num_keysyms; i++)
*(s->ctrl.symbols_displayed + i) = *(syms + i);
(*s->CtrlProc) (dev, &s->ctrl);
return Success;
}
}
/******************************************************************************
*
......@@ -546,16 +546,16 @@ ChangeBellFeedback (client, dev, mask, b, f)
unsigned long mask;
BellFeedbackPtr b;
xBellFeedbackCtl *f;
{
{
int t;
BellCtrl bctrl; /* might get BadValue part way through */
BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped)
{
swaps(&f->length);
swaps(&f->pitch);
swaps(&f->duration);
}
}
bctrl = b->ctrl;
if (mask & DvPercent)
......@@ -566,12 +566,12 @@ ChangeBellFeedback (client, dev, mask, b, f)
else if (t < 0 || t > 100)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
bctrl.percent = t;
}
bctrl.percent = t;
}
if (mask & DvPitch)
{
......@@ -581,12 +581,12 @@ ChangeBellFeedback (client, dev, mask, b, f)
else if (t < 0)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
bctrl.pitch = t;
}
bctrl.pitch = t;
}
if (mask & DvDuration)
{
......@@ -596,16 +596,16 @@ ChangeBellFeedback (client, dev, mask, b, f)
else if (t < 0)
{
client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
}
bctrl.duration = t;
}
}
b->ctrl = bctrl;
(*b->CtrlProc)(dev, &b->ctrl);
(*b->CtrlProc) (dev, &b->ctrl);
return Success;
}
}
/******************************************************************************
*
......@@ -620,15 +620,15 @@ ChangeLedFeedback (client, dev, mask, l, f)
unsigned long mask;
LedFeedbackPtr l;
xLedFeedbackCtl *f;
{
LedCtrl lctrl; /* might get BadValue part way through */
{
LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped)
{
swaps(&f->length);
swapl(&f->led_values);
swapl(&f->led_mask);
}
}
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
f->led_values &= l->ctrl.led_mask; /* set only supported leds */
......@@ -636,10 +636,10 @@ ChangeLedFeedback (client, dev, mask, l, f)
{
lctrl.led_mask = f->led_mask;
lctrl.led_values = f->led_values;
(*l->CtrlProc)(dev, &lctrl);
l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
l->ctrl.led_values |= (f->led_mask & f->led_values);/* OR in set leds*/
}
(*l->CtrlProc) (dev, &lctrl);
l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
}
return Success;
}
}
......@@ -33,65 +33,65 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXChangeFeedbackControl(
ClientPtr /* client */
);
);
int
ProcXChangeFeedbackControl(
ClientPtr /* client */
);
);
int
ChangeKbdFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
KbdFeedbackPtr /* k */,
xKbdFeedbackCtl * /* f */
);
DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
KbdFeedbackPtr /* k */ ,
xKbdFeedbackCtl * /* f */
);
int
ChangePtrFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
PtrFeedbackPtr /* p */,
xPtrFeedbackCtl * /* f */
);
DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
PtrFeedbackPtr /* p */ ,
xPtrFeedbackCtl * /* f */
);
int
ChangeIntegerFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
IntegerFeedbackPtr /* i */,
xIntegerFeedbackCtl * /* f */
);
DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
IntegerFeedbackPtr /* i */ ,
xIntegerFeedbackCtl * /* f */
);
int
ChangeStringFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
StringFeedbackPtr /* s */,
xStringFeedbackCtl * /* f */
);
DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
StringFeedbackPtr /* s */ ,
xStringFeedbackCtl * /* f */
);
int
ChangeBellFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
BellFeedbackPtr /* b */,
xBellFeedbackCtl * /* f */
);
DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
BellFeedbackPtr /* b */ ,
xBellFeedbackCtl * /* f */
);
int
ChangeLedFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
LedFeedbackPtr /* l */,
xLedFeedbackCtl * /* f */
);
DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
LedFeedbackPtr /* l */ ,
xLedFeedbackCtl * /* f */
);
#endif /* CHGFCTL_H */
......@@ -80,12 +80,12 @@ SOFTWARE.
int
SProcXChangeKeyboardDevice(client)
register ClientPtr client;
{
{
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return(ProcXChangeKeyboardDevice(client));
}
return (ProcXChangeKeyboardDevice(client));
}
/***********************************************************************
*
......@@ -97,15 +97,15 @@ SProcXChangeKeyboardDevice(client)
int
ProcXChangeKeyboardDevice (client)
register ClientPtr client;
{
int i;
DeviceIntPtr xkbd = inputInfo.keyboard;
DeviceIntPtr dev;
FocusClassPtr xf = xkbd->focus;
FocusClassPtr df;
KeyClassPtr k;
xChangeKeyboardDeviceReply rep;
changeDeviceNotify ev;
{
int i;
DeviceIntPtr xkbd = inputInfo.keyboard;
DeviceIntPtr dev;
FocusClassPtr xf = xkbd->focus;
FocusClassPtr df;
KeyClassPtr k;
xChangeKeyboardDeviceReply rep;
changeDeviceNotify ev;
REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
......@@ -115,29 +115,29 @@ ProcXChangeKeyboardDevice (client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
return Success;
}
}
k = dev->key;
if (k == NULL)
{
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadMatch);
return Success;
}
}
if (((dev->grab) && !SameClient(dev->grab, client)) ||
((xkbd->grab) && !SameClient(xkbd->grab, client)))
((xkbd->grab) && !SameClient(xkbd->grab, client)))
rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen &&
dev->sync.other && !SameClient(dev->sync.other, client)) ||
dev->sync.other && !SameClient(dev->sync.other, client)) ||
(xkbd->sync.frozen &&
xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
rep.status = GrabFrozen;
......@@ -145,15 +145,15 @@ ProcXChangeKeyboardDevice (client)
{
if (ChangeKeyboardDevice (xkbd, dev) != Success)
{
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
return Success;
}
}
if (!dev->focus)
InitFocusClassDeviceStruct (dev);
InitFocusClassDeviceStruct(dev);
if (!dev->kbdfeed)
InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr)NoopDDA,
(KbdCtrlProcPtr)NoopDDA);
InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA,
(KbdCtrlProcPtr) NoopDDA);
df = dev->focus;
df->win = xf->win;
df->revert = xf->revert;
......@@ -161,33 +161,33 @@ ProcXChangeKeyboardDevice (client)
df->traceGood = xf->traceGood;
if (df->traceSize != xf->traceSize)
{
Must_have_memory = TRUE; /* XXX */
df->trace = (WindowPtr *) realloc(df->trace,
Must_have_memory = TRUE; /* XXX */
df->trace = (WindowPtr *) realloc(df->trace,
xf->traceSize * sizeof(WindowPtr));
Must_have_memory = FALSE; /* XXX */
}
Must_have_memory = FALSE; /* XXX */
}
df->traceSize = xf->traceSize;
for (i=0; i<df->traceSize; i++)
for (i = 0; i < df->traceSize; i++)
df->trace[i] = xf->trace[i];
RegisterOtherDevice (xkbd);
RegisterKeyboardDevice (dev);
RegisterOtherDevice(xkbd);
RegisterKeyboardDevice(dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewKeyboard;
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode,
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
rep.status = 0;
}
}
WriteReplyToClient (client, sizeof (xChangeKeyboardDeviceReply),
&rep);
return Success;
}
}
/***********************************************************************
*
......@@ -201,8 +201,8 @@ SRepXChangeKeyboardDevice (client, size, rep)
ClientPtr client;
int size;
xChangeKeyboardDeviceReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,19 +33,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXChangeKeyboardDevice(
ClientPtr /* client */
);
);
int
ProcXChangeKeyboardDevice (
ClientPtr /* client */
);
);
void
SRepXChangeKeyboardDevice (
ClientPtr /* client */,
int /* size */,
xChangeKeyboardDeviceReply * /* rep */
);
int /* size */ ,
xChangeKeyboardDeviceReply * /* rep */
);
#endif /* CHGKBD_H */
......@@ -77,7 +77,7 @@ SOFTWARE.
int
SProcXChangeDeviceKeyMapping(client)
register ClientPtr client;
{
{
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
......@@ -86,8 +86,8 @@ SProcXChangeDeviceKeyMapping(client)
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), count);
return(ProcXChangeDeviceKeyMapping(client));
}
return (ProcXChangeDeviceKeyMapping(client));
}
/***********************************************************************
*
......@@ -98,8 +98,8 @@ SProcXChangeDeviceKeyMapping(client)
int
ProcXChangeDeviceKeyMapping(client)
register ClientPtr client;
{
int ret;
{
int ret;
unsigned len;
DeviceIntPtr dev;
unsigned int count;
......@@ -110,16 +110,16 @@ ProcXChangeDeviceKeyMapping(client)
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0,
BadDevice);
return Success;
}
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
}
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
(KeySym *)&stuff[1]);
......@@ -127,4 +127,4 @@ ProcXChangeDeviceKeyMapping(client)
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
ret);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXChangeDeviceKeyMapping(
ClientPtr /* client */
);
);
int
ProcXChangeDeviceKeyMapping(
ClientPtr /* client */
);
);
#endif /* CHGKMAP_H */
......@@ -79,17 +79,17 @@ SOFTWARE.
int
SProcXChangeDeviceDontPropagateList(client)
register ClientPtr client;
{
{
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
stuff->count * sizeof(CARD32));
stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return(ProcXChangeDeviceDontPropagateList(client));
}
return (ProcXChangeDeviceDontPropagateList(client));
}
/***********************************************************************
*
......@@ -100,43 +100,43 @@ SProcXChangeDeviceDontPropagateList(client)
int
ProcXChangeDeviceDontPropagateList (client)
register ClientPtr client;
{
int i;
WindowPtr pWin;
struct tmask tmp[EMASKSIZE];
OtherInputMasks *others;
{
int i;
WindowPtr pWin;
struct tmask tmp[EMASKSIZE];
OtherInputMasks *others;
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (stuff->length !=(sizeof(xChangeDeviceDontPropagateListReq)>>2) +
if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) +
stuff->count)
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadLength);
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadLength);
return Success;
}
}
pWin = (WindowPtr) LookupWindow (stuff->window, client);
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin)
{
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadWindow);
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadWindow);
return Success;
}
}
if (stuff->mode != AddToList && stuff->mode != DeleteFromList)
{
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadMode);
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadMode);
return Success;
}
}
if (CreateMaskFromList (client, (XEventClass *)&stuff[1],
if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success)
return Success;
return Success;
others = wOtherInputMasks(pWin);
if (!others && stuff->mode == DeleteFromList)
......@@ -156,8 +156,8 @@ ProcXChangeDeviceDontPropagateList (client)
SendErrorToClient ( client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadClass);
return Success;
}
}
}
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXChangeDeviceDontPropagateList (
ClientPtr /* client */
);
);
int
ProcXChangeDeviceDontPropagateList (
ClientPtr /* client */
);
);
#endif /* CHGPROP_H */
......@@ -83,12 +83,12 @@ SOFTWARE.
int
SProcXChangePointerDevice(client)
register ClientPtr client;
{
{
REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return(ProcXChangePointerDevice(client));
}
return (ProcXChangePointerDevice(client));
}
/***********************************************************************
*
......@@ -99,12 +99,12 @@ SProcXChangePointerDevice(client)
int
ProcXChangePointerDevice (client)
register ClientPtr client;
{
DeviceIntPtr xptr = inputInfo.pointer;
DeviceIntPtr dev;
ValuatorClassPtr v;
xChangePointerDeviceReply rep;
changeDeviceNotify ev;
{
DeviceIntPtr xptr = inputInfo.pointer;
DeviceIntPtr dev;
ValuatorClassPtr v;
xChangePointerDeviceReply rep;
changeDeviceNotify ev;
REQUEST(xChangePointerDeviceReq);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
......@@ -114,30 +114,30 @@ ProcXChangePointerDevice (client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
return Success;
}
}
v = dev->valuator;
if (v == NULL || v->numAxes < 2 ||
if (v == NULL || v->numAxes < 2 ||
stuff->xaxis >= v->numAxes ||
stuff->yaxis >= v->numAxes)
{
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
return Success;
}
}
if (((dev->grab) && !SameClient(dev->grab, client)) ||
((xptr->grab) && !SameClient(xptr->grab, client)))
((xptr->grab) && !SameClient(xptr->grab, client)))
rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen &&
dev->sync.other && !SameClient(dev->sync.other, client)) ||
dev->sync.other && !SameClient(dev->sync.other, client)) ||
(xptr->sync.frozen &&
xptr->sync.other && !SameClient(xptr->sync.other, client)))
rep.status = GrabFrozen;
......@@ -146,43 +146,43 @@ ProcXChangePointerDevice (client)
if (ChangePointerDevice (
xptr, dev, stuff->xaxis, stuff->yaxis) != Success)
{
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
return Success;
}
}
if (dev->focus)
DeleteFocusClassDeviceStruct(dev);
if (!dev->button)
InitButtonClassDeviceStruct (dev, 0, NULL);
InitButtonClassDeviceStruct(dev, 0, NULL);
if (!dev->ptrfeed)
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
RegisterOtherDevice (xptr);
RegisterPointerDevice (dev);
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA);
RegisterOtherDevice(xptr);
RegisterPointerDevice(dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewPointer;
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingPointer, 0, 0, client);
SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
SendMappingNotify(MappingPointer, 0, 0, client);
rep.status = 0;
}
}
WriteReplyToClient (client, sizeof (xChangePointerDeviceReply),
&rep);
return Success;
}
}
void
DeleteFocusClassDeviceStruct(dev)
DeviceIntPtr dev;
{
{
free(dev->focus->trace);
free(dev->focus);
dev->focus = NULL;
}
}
/***********************************************************************
*
......@@ -196,7 +196,7 @@ SendEventToAllWindows (dev, mask, ev, count)
Mask mask;
xEvent *ev;
int count;
{
{
int i;
WindowPtr pWin, p1;
......@@ -205,9 +205,9 @@ SendEventToAllWindows (dev, mask, ev, count)
pWin = screenInfo.screens[i]->root;
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild;
FindInterestedChildren (dev, p1, mask, ev, count);
}
FindInterestedChildren(dev, p1, mask, ev, count);
}
}
/***********************************************************************
*
......@@ -223,17 +223,17 @@ FindInterestedChildren (dev, p1, mask, ev, count)
Mask mask;
xEvent *ev;
int count;
{
{
WindowPtr p2;
while (p1)
{
p2 = p1->firstChild;
p2 = p1->firstChild;
(void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
FindInterestedChildren (dev, p2, mask, ev, count);
FindInterestedChildren(dev, p2, mask, ev, count);
p1 = p1->nextSib;
}
}
}
/***********************************************************************
*
......@@ -247,8 +247,8 @@ SRepXChangePointerDevice (client, size, rep)
ClientPtr client;
int size;
xChangePointerDeviceReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,40 +33,40 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXChangePointerDevice(
ClientPtr /* client */
);
);
int
ProcXChangePointerDevice (
ClientPtr /* client */
);
);
void
DeleteFocusClassDeviceStruct(
DeviceIntPtr /* dev */
);
);
void
SendEventToAllWindows (
DeviceIntPtr /* dev */,
Mask /* mask */,
xEvent * /* ev */,
int /* count */
);
Mask /* mask */ ,
xEvent * /* ev */ ,
int /* count */
);
void
FindInterestedChildren ( /* FIXME: could be static? */
DeviceIntPtr /* dev */,
WindowPtr /* p1 */,
Mask /* mask */,
xEvent * /* ev */,
int /* count */
);
DeviceIntPtr /* dev */ ,
WindowPtr /* p1 */ ,
Mask /* mask */ ,
xEvent * /* ev */ ,
int /* count */
);
void
SRepXChangePointerDevice (
ClientPtr /* client */,
int /* size */,
xChangePointerDeviceReply * /* rep */
);
int /* size */ ,
xChangePointerDeviceReply * /* rep */
);
#endif /* CHGPTR_H */
......@@ -78,12 +78,12 @@ SOFTWARE.
int
SProcXCloseDevice(client)
register ClientPtr client;
{
{
REQUEST(xCloseDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
return(ProcXCloseDevice(client));
}
return (ProcXCloseDevice(client));
}
/***********************************************************************
*
......@@ -94,23 +94,23 @@ SProcXCloseDevice(client)
int
ProcXCloseDevice(client)
register ClientPtr client;
{
int i;
WindowPtr pWin, p1;
DeviceIntPtr d;
{
int i;
WindowPtr pWin, p1;
DeviceIntPtr d;
REQUEST(xCloseDeviceReq);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
d = LookupDeviceIntRec (stuff->deviceid);
d = LookupDeviceIntRec(stuff->deviceid);
if (d == NULL)
{
SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
return Success;
}
return Success;
}
if (d->grab && SameClient(d->grab, client))
(*d->DeactivateGrab)(d); /* release active grab */
(*d->DeactivateGrab) (d); /* release active grab */
/* Remove event selections from all windows for events from this device
and selected by this client.
......@@ -119,14 +119,14 @@ ProcXCloseDevice(client)
for (i=0; i<screenInfo.numScreens; i++)
{
pWin = screenInfo.screens[i]->root;
DeleteDeviceEvents (d, pWin, client);
DeleteDeviceEvents(d, pWin, client);
p1 = pWin->firstChild;
DeleteEventsFromChildren (d, p1, client);
}
DeleteEventsFromChildren(d, p1, client);
}
CloseInputDevice (d, client);
CloseInputDevice(d, client);
return Success;
}
}
/***********************************************************************
*
......@@ -140,17 +140,17 @@ DeleteEventsFromChildren(dev, p1, client)
DeviceIntPtr dev;
WindowPtr p1;
ClientPtr client;
{
{
WindowPtr p2;
while (p1)
{
p2 = p1->firstChild;
DeleteDeviceEvents (dev, p1, client);
p2 = p1->firstChild;
DeleteDeviceEvents(dev, p1, client);
DeleteEventsFromChildren(dev, p2, client);
p1 = p1->nextSib;
}
}
}
/***********************************************************************
*
......@@ -164,15 +164,15 @@ DeleteDeviceEvents (dev, pWin, client)
DeviceIntPtr dev;
WindowPtr pWin;
ClientPtr client;
{
InputClientsPtr others;
OtherInputMasks *pOthers;
GrabPtr grab, next;
{
InputClientsPtr others;
OtherInputMasks *pOthers;
GrabPtr grab, next;
if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others=pOthers->inputClients; others;
others = others->next)
if (SameClient(others,client))
if (SameClient(others, client))
others->mask[dev->id] = NoEventMask;
for (grab = wPassiveGrabs(pWin); grab; grab=next)
......@@ -180,6 +180,6 @@ DeleteDeviceEvents (dev, pWin, client)
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource (grab->resource, RT_NONE);
}
FreeResource(grab->resource, RT_NONE);
}
}
......@@ -33,25 +33,25 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXCloseDevice(
ClientPtr /* client */
);
);
int
ProcXCloseDevice(
ClientPtr /* client */
);
);
void
DeleteEventsFromChildren(
DeviceIntPtr /* dev */,
WindowPtr /* p1 */,
ClientPtr /* client */
);
WindowPtr /* p1 */ ,
ClientPtr /* client */
);
void
DeleteDeviceEvents (
DeviceIntPtr /* dev */,
WindowPtr /* pWin */,
ClientPtr /* client */
);
WindowPtr /* pWin */ ,
ClientPtr /* client */
);
#endif /* CLOSEDEV_H */
......@@ -76,11 +76,11 @@ SOFTWARE.
int
SProcXDeviceBell(client)
register ClientPtr client;
{
{
REQUEST(xDeviceBellReq);
swaps(&stuff->length);
return(ProcXDeviceBell(client));
}
return (ProcXDeviceBell(client));
}
/***********************************************************************
*
......@@ -91,36 +91,36 @@ SProcXDeviceBell(client)
int
ProcXDeviceBell (client)
register ClientPtr client;
{
{
DeviceIntPtr dev;
KbdFeedbackPtr k;
BellFeedbackPtr b;
int base;
int newpercent;
CARD8 class;
void * ctrl;
void *ctrl;
BellProcPtr proc;
REQUEST(xDeviceBellReq);
REQUEST_SIZE_MATCH(xDeviceBellReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
client->errorValue = stuff->deviceid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
return Success;
}
}
if (stuff->percent < -100 || stuff->percent > 100)
{
client->errorValue = stuff->percent;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
}
}
if (stuff->feedbackclass == KbdFeedbackClass)
{
for (k=dev->kbdfeed; k; k=k->next)
for (k = dev->kbdfeed; k; k = k->next)
if (k->ctrl.id == stuff->feedbackid)
break;
if (!k)
......@@ -128,15 +128,15 @@ ProcXDeviceBell (client)
client->errorValue = stuff->feedbackid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
}
}
base = k->ctrl.bell;
proc = k->BellProc;
ctrl = (void *) &(k->ctrl);
ctrl = (void *)&(k->ctrl);
class = KbdFeedbackClass;
}
else if (stuff->feedbackclass == BellFeedbackClass)
{
for (b=dev->bell; b; b=b->next)
for (b = dev->bell; b; b = b->next)
if (b->ctrl.id == stuff->feedbackid)
break;
if (!b)
......@@ -144,10 +144,10 @@ ProcXDeviceBell (client)
client->errorValue = stuff->feedbackid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
}
}
base = b->ctrl.percent;
proc = b->BellProc;
ctrl = (void *) &(b->ctrl);
ctrl = (void *)&(b->ctrl);
class = BellFeedbackClass;
}
else
......@@ -155,13 +155,13 @@ ProcXDeviceBell (client)
client->errorValue = stuff->feedbackclass;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
}
}
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
newpercent = base + newpercent;
newpercent = base + newpercent;
else
newpercent = base - newpercent + stuff->percent;
(*proc)(newpercent, dev, ctrl, class);
newpercent = base - newpercent + stuff->percent;
(*proc) (newpercent, dev, ctrl, class);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXDeviceBell (
ClientPtr /* client */
);
);
int
ProcXDeviceBell (
ClientPtr /* client */
);
);
#endif /* DEVBELL_H */
......@@ -84,11 +84,11 @@ SOFTWARE.
static Bool ShouldFreeInputMasks(
WindowPtr /* pWin */,
Bool /* ignoreSelectedEvents */
);
Bool /* ignoreSelectedEvents */
);
static Bool MakeInputMasks (
WindowPtr /* pWin */
);
);
/**************************************************************************
*
......@@ -99,12 +99,12 @@ static Bool MakeInputMasks (
void
RegisterOtherDevice (device)
DeviceIntPtr device;
{
{
device->public.processInputProc = ProcessOtherEvent;
device->public.realInputProc = ProcessOtherEvent;
(device)->ActivateGrab = ActivateKeyboardGrab;
(device)->DeactivateGrab = DeactivateKeyboardGrab;
}
}
/*ARGSUSED*/
void
......@@ -112,28 +112,28 @@ ProcessOtherEvent (xE, other, count)
xEventPtr xE;
register DeviceIntPtr other;
int count;
{
register BYTE *kptr;
register int i;
register CARD16 modifiers;
register CARD16 mask;
GrabPtr grab = other->grab;
Bool deactivateDeviceGrab = FALSE;
int key = 0, bit = 0, rootX, rootY;
ButtonClassPtr b = other->button;
KeyClassPtr k = other->key;
ValuatorClassPtr v = other->valuator;
deviceValuator *xV = (deviceValuator *) xE;
{
register BYTE *kptr;
register int i;
register CARD16 modifiers;
register CARD16 mask;
GrabPtr grab = other->grab;
Bool deactivateDeviceGrab = FALSE;
int key = 0, bit = 0, rootX, rootY;
ButtonClassPtr b = other->button;
KeyClassPtr k = other->key;
ValuatorClassPtr v = other->valuator;
deviceValuator *xV = (deviceValuator *) xE;
if (xE->u.u.type != DeviceValuator) {
GetSpritePosition(&rootX, &rootY);
xE->u.keyButtonPointer.rootX = rootX;
xE->u.keyButtonPointer.rootY = rootY;
key = xE->u.u.detail;
NoticeEventTime(xE);
xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
inputInfo.pointer->button->state;
bit = 1 << (key & 7);
GetSpritePosition(&rootX, &rootY);
xE->u.keyButtonPointer.rootX = rootX;
xE->u.keyButtonPointer.rootY = rootY;
key = xE->u.u.detail;
NoticeEventTime(xE);
xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
inputInfo.pointer->button->state;
bit = 1 << (key & 7);
}
if (DeviceEventCallback)
{
......@@ -142,7 +142,7 @@ ProcessOtherEvent (xE, other, count)
eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo);
}
for (i=1; i<count; i++)
for (i = 1; i < count; i++)
if ((++xV)->type == DeviceValuator)
{
int first = xV->first_valuator;
......@@ -154,34 +154,34 @@ ProcessOtherEvent (xE, other, count)
if (k)
xV->device_state |= k->state;
if (b)
xV->device_state |= b->state;
xV->device_state |= b->state;
if (v && v->axisVal)
{
axisvals = v->axisVal;
switch (xV->num_valuators) {
case 6:
*(axisvals+first+5) = xV->valuator5;
case 5:
*(axisvals+first+4) = xV->valuator4;
case 4:
*(axisvals+first+3) = xV->valuator3;
case 3:
*(axisvals+first+2) = xV->valuator2;
case 2:
*(axisvals+first+1) = xV->valuator1;
case 1:
*(axisvals+first) = xV->valuator0;
case 0:
default:
break;
}
axisvals = v->axisVal;
switch (xV->num_valuators) {
case 6:
*(axisvals + first + 5) = xV->valuator5;
case 5:
*(axisvals + first + 4) = xV->valuator4;
case 4:
*(axisvals + first + 3) = xV->valuator3;
case 3:
*(axisvals + first + 2) = xV->valuator2;
case 2:
*(axisvals + first + 1) = xV->valuator1;
case 1:
*(axisvals + first) = xV->valuator0;
case 0:
default:
break;
}
}
}
if (xE->u.u.type == DeviceKeyPress)
{
modifiers = k->modifierMap[key];
kptr = &k->down[key >> 3];
kptr = &k->down[key >> 3];
if (*kptr & bit) /* allow ddx to generate multiple downs */
{
if (!modifiers)
......@@ -189,11 +189,11 @@ ProcessOtherEvent (xE, other, count)
xE->u.u.type = DeviceKeyRelease;
ProcessOtherEvent(xE, other, count);
xE->u.u.type = DeviceKeyPress;
/* release can have side effects, don't fall through */
/* release can have side effects, don't fall through */
ProcessOtherEvent(xE, other, count);
}
return;
}
return;
}
if (other->valuator)
other->valuator->motionHintWindow = NullWindow;
*kptr |= bit;
......@@ -202,22 +202,22 @@ ProcessOtherEvent (xE, other, count)
{
if (mask & modifiers)
{
/* This key affects modifier "i" */
/* This key affects modifier "i" */
k->modifierKeyCount[i]++;
k->state |= mask;
modifiers &= ~mask;
}
}
}
if (!grab && CheckDeviceGrabs(other, xE, 0, count))
{
other->activatingKey = key;
return;
}
}
}
else if (xE->u.u.type == DeviceKeyRelease)
{
kptr = &k->down[key >> 3];
if (!(*kptr & bit)) /* guard against duplicates */
kptr = &k->down[key >> 3];
if (!(*kptr & bit)) /* guard against duplicates */
return;
modifiers = k->modifierMap[key];
if (other->valuator)
......@@ -228,22 +228,22 @@ ProcessOtherEvent (xE, other, count)
{
if (mask & modifiers)
{
/* This key affects modifier "i" */
/* This key affects modifier "i" */
if (--k->modifierKeyCount[i] <= 0)
{
k->modifierKeyCount[i] = 0;
k->state &= ~mask;
}
modifiers &= ~mask;
}
modifiers &= ~mask;
}
}
if (other->fromPassiveGrab && (key == other->activatingKey))
deactivateDeviceGrab = TRUE;
}
else if (xE->u.u.type == DeviceButtonPress)
{
kptr = &b->down[key >> 3];
kptr = &b->down[key >> 3];
*kptr |= bit;
if (other->valuator)
other->valuator->motionHintWindow = NullWindow;
......@@ -251,10 +251,10 @@ ProcessOtherEvent (xE, other, count)
b->motionMask = DeviceButtonMotionMask;
xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0)
return;
return;
if (xE->u.u.detail <= 5)
b->state |= (Button1Mask >> 1) << xE->u.u.detail;
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
if (!grab)
if (CheckDeviceGrabs(other, xE, 0, count))
return;
......@@ -262,18 +262,18 @@ ProcessOtherEvent (xE, other, count)
}
else if (xE->u.u.type == DeviceButtonRelease)
{
kptr = &b->down[key >> 3];
kptr = &b->down[key >> 3];
*kptr &= ~bit;
if (other->valuator)
other->valuator->motionHintWindow = NullWindow;
if (!--b->buttonsDown)
b->motionMask = 0;
b->motionMask = 0;
xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0)
return;
if (xE->u.u.detail <= 5)
b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
if (!b->state && other->fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
......@@ -291,15 +291,15 @@ ProcessOtherEvent (xE, other, count)
other, count);
if (deactivateDeviceGrab == TRUE)
(*other->DeactivateGrab)(other);
}
(*other->DeactivateGrab) (other);
}
int
InitProximityClassDeviceStruct( DeviceIntPtr dev)
InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
register ProximityClassPtr proxc;
proxc = (ProximityClassPtr)malloc(sizeof(ProximityClassRec));
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
if (!proxc)
return FALSE;
dev->proximity = proxc;
......@@ -344,13 +344,13 @@ FixDeviceStateNotify (
if (b) {
ev->classes_reported |= (1 << ButtonClass);
ev->num_buttons = b->numButtons;
memmove((char *) &ev->buttons[0], (char *) b->down, 4);
memmove((char *)&ev->buttons[0], (char *)b->down, 4);
}
else if (k) {
ev->classes_reported |= (1 << KeyClass);
ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
memmove((char *) &ev->keys[0], (char *) k->down, 4);
}
memmove((char *)&ev->keys[0], (char *)k->down, 4);
}
if (v) {
int nval = v->numAxes - first;
ev->classes_reported |= (1 << ValuatorClass);
......@@ -358,23 +358,23 @@ FixDeviceStateNotify (
ev->num_valuators = nval < 3 ? nval : 3;
switch (ev->num_valuators)
{
case 3:
ev->valuator2 = v->axisVal[first+2];
case 2:
ev->valuator1 = v->axisVal[first+1];
case 1:
ev->valuator0 = v->axisVal[first];
case 3:
ev->valuator2 = v->axisVal[first + 2];
case 2:
ev->valuator1 = v->axisVal[first + 1];
case 1:
ev->valuator0 = v->axisVal[first];
break;
}
}
}
}
static void
FixDeviceValuator (
DeviceIntPtr dev,
deviceValuator *ev,
ValuatorClassPtr v,
int first)
int first)
{
int nval = v->numAxes - first;
......@@ -383,24 +383,24 @@ FixDeviceValuator (
ev->num_valuators = nval < 3 ? nval : 3;
ev->first_valuator = first;
switch (ev->num_valuators) {
case 3:
ev->valuator2 = v->axisVal[first+2];
case 2:
ev->valuator1 = v->axisVal[first+1];
case 1:
ev->valuator0 = v->axisVal[first];
case 3:
ev->valuator2 = v->axisVal[first + 2];
case 2:
ev->valuator1 = v->axisVal[first + 1];
case 1:
ev->valuator0 = v->axisVal[first];
break;
}
first += ev->num_valuators;
}
first += ev->num_valuators;
}
void
DeviceFocusEvent(dev, type, mode, detail, pWin)
DeviceIntPtr dev;
int type, mode, detail;
register WindowPtr pWin;
{
deviceFocus event;
{
deviceFocus event;
if (type == FocusIn)
type = DeviceFocusIn;
......@@ -414,29 +414,29 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
event.window = pWin->drawable.id;
event.time = currentTime.milliseconds;
(void) DeliverEventsToWindow(pWin, (xEvent *)&event, 1,
DeviceFocusChangeMask, NullGrab, dev->id);
(void)DeliverEventsToWindow(pWin, (xEvent *) & event, 1,
DeviceFocusChangeMask, NullGrab, dev->id);
if ((type == DeviceFocusIn) &&
if ((type == DeviceFocusIn) &&
(wOtherInputMasks(pWin)) &&
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
{
int evcount = 1;
deviceStateNotify *ev, *sev;
deviceKeyStateNotify *kev;
{
int evcount = 1;
deviceStateNotify *ev, *sev;
deviceKeyStateNotify *kev;
deviceButtonStateNotify *bev;
KeyClassPtr k;
ButtonClassPtr b;
ValuatorClassPtr v;
int nval=0, nkeys=0, nbuttons=0, first=0;
int nval = 0, nkeys = 0, nbuttons = 0, first = 0;
if ((b=dev->button) != NULL) {
if ((b = dev->button) != NULL) {
nbuttons = b->numButtons;
if (nbuttons > 32)
evcount++;
}
if ((k=dev->key) != NULL) {
if ((k = dev->key) != NULL) {
nkeys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
if (nkeys > 32)
evcount++;
......@@ -444,7 +444,7 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
evcount++;
}
}
if ((v=dev->valuator) != NULL) {
if ((v = dev->valuator) != NULL) {
nval = v->numAxes;
if (nval > 3)
......@@ -458,63 +458,63 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
}
sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
FixDeviceStateNotify (dev, ev, NULL, NULL, NULL, first);
FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
if (b != NULL) {
FixDeviceStateNotify (dev, ev++, NULL, b, v, first);
FixDeviceStateNotify(dev, ev++, NULL, b, v, first);
first += 3;
nval -= 3;
if (nbuttons > 32) {
(ev-1)->deviceid |= MORE_EVENTS;
bev = (deviceButtonStateNotify *) ev++;
(ev - 1)->deviceid |= MORE_EVENTS;
bev = (deviceButtonStateNotify *) ev++;
bev->type = DeviceButtonStateNotify;
bev->deviceid = dev->id;
memmove((char *) &bev->buttons[0], (char *) &b->down[4], 28);
memmove((char *)&bev->buttons[0], (char *)&b->down[4], 28);
}
if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
(ev - 1)->deviceid |= MORE_EVENTS;
FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
first += 3;
nval -= 3;
}
}
if (k != NULL) {
FixDeviceStateNotify (dev, ev++, k, NULL, v, first);
FixDeviceStateNotify(dev, ev++, k, NULL, v, first);
first += 3;
nval -= 3;
if (nkeys > 32) {
(ev-1)->deviceid |= MORE_EVENTS;
kev = (deviceKeyStateNotify *) ev++;
(ev - 1)->deviceid |= MORE_EVENTS;
kev = (deviceKeyStateNotify *) ev++;
kev->type = DeviceKeyStateNotify;
kev->deviceid = dev->id;
memmove((char *) &kev->keys[0], (char *) &k->down[4], 28);
memmove((char *)&kev->keys[0], (char *)&k->down[4], 28);
}
if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
(ev - 1)->deviceid |= MORE_EVENTS;
FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
first += 3;
nval -= 3;
}
}
while (nval > 0) {
FixDeviceStateNotify (dev, ev++, NULL, NULL, v, first);
FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first);
first += 3;
nval -= 3;
if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
(ev - 1)->deviceid |= MORE_EVENTS;
FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
first += 3;
nval -= 3;
}
}
(void) DeliverEventsToWindow(pWin, (xEvent *)sev, evcount,
DeviceStateNotifyMask, NullGrab, dev->id);
free (sev);
}
(void)DeliverEventsToWindow(pWin, (xEvent *) sev, evcount,
DeviceStateNotifyMask, NullGrab, dev->id);
free(sev);
}
}
int
GrabButton(
......@@ -539,13 +539,13 @@ GrabButton(
(this_device_mode != GrabModeAsync))
{
client->errorValue = this_device_mode;
return BadValue;
return BadValue;
}
if ((other_devices_mode != GrabModeSync) &&
(other_devices_mode != GrabModeAsync))
{
client->errorValue = other_devices_mode;
return BadValue;
return BadValue;
}
if ((modifiers != AnyModifier) &&
(modifiers & ~AllModifiersMask))
......@@ -573,7 +573,7 @@ GrabButton(
cursor = NullCursor;
else
{
cursor = (CursorPtr)LookupIDByType(rcursor, RT_CURSOR);
cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR);
if (!cursor)
{
client->errorValue = rcursor;
......@@ -588,7 +588,7 @@ GrabButton(
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
}
}
int
GrabKey(
......@@ -607,26 +607,26 @@ GrabKey(
GrabPtr grab;
KeyClassPtr k = dev->key;
if (k==NULL)
if (k == NULL)
return BadMatch;
if ((other_devices_mode != GrabModeSync) &&
(other_devices_mode != GrabModeAsync))
{
client->errorValue = other_devices_mode;
return BadValue;
return BadValue;
}
if ((this_device_mode != GrabModeSync) &&
(this_device_mode != GrabModeAsync))
{
client->errorValue = this_device_mode;
return BadValue;
return BadValue;
}
if (((key > k->curKeySyms.maxKeyCode) ||
(key < k->curKeySyms.minKeyCode))
&& (key != AnyKey))
{
client->errorValue = key;
return BadValue;
return BadValue;
}
if ((modifiers != AnyModifier) &&
(modifiers & ~AllModifiersMask))
......@@ -637,20 +637,20 @@ GrabKey(
if ((ownerEvents != xTrue) && (ownerEvents != xFalse))
{
client->errorValue = ownerEvents;
return BadValue;
return BadValue;
}
pWin = LookupWindow(grabWindow, client);
if (!pWin)
return BadWindow;
grab = CreateGrab(client->index, dev, pWin,
mask, ownerEvents, this_device_mode, other_devices_mode,
grab = CreateGrab(client->index, dev, pWin,
mask, ownerEvents, this_device_mode, other_devices_mode,
modifier_device, modifiers, DeviceKeyPress, key, NullWindow,
NullCursor);
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
}
}
int
SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
......@@ -681,15 +681,15 @@ SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
it is OK, for some client to
continue selecting on one of those
events. */
for (others = wOtherInputMasks(pWin)->inputClients; others;
for (others = wOtherInputMasks(pWin)->inputClients; others;
others = others->next)
{
if (!SameClient(others, client) && (check &
others->mask[mskidx]))
if (!SameClient(others, client) && (check &
others->mask[mskidx]))
return BadAccess;
}
}
for (others = wOtherInputMasks(pWin)->inputClients; others;
}
}
for (others = wOtherInputMasks(pWin)->inputClients; others;
others = others->next)
{
if (SameClient(others, client))
......@@ -698,7 +698,7 @@ SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
others->mask[mskidx] = mask;
if (mask == 0)
{
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
if (i != mskidx && others->mask[i] != 0)
break;
if (i == EMASKSIZE)
......@@ -706,17 +706,17 @@ SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(others->resource, RT_NONE);
return Success;
}
return Success;
}
}
goto maskSet;
}
}
}
}
check = 0;
if ((ret = AddExtensionClient (pWin, client, mask, mskidx)) != Success)
if ((ret = AddExtensionClient(pWin, client, mask, mskidx)) != Success)
return ret;
maskSet:
maskSet:
if (dev->valuator)
if ((dev->valuator->motionHintWindow == pWin) &&
(mask & DevicePointerMotionHintMask) &&
......@@ -727,23 +727,23 @@ maskSet:
return Success;
}
int
int
AddExtensionClient (pWin, client, mask, mskidx)
WindowPtr pWin;
ClientPtr client;
Mask mask;
int mskidx;
{
{
InputClientsPtr others;
if (!pWin->optional && !MakeWindowOptional (pWin))
if (!pWin->optional && !MakeWindowOptional(pWin))
return BadAlloc;
others = (InputClients *) malloc(sizeof(InputClients));
if (!others)
return BadAlloc;
if (!pWin->optional->inputMasks && !MakeInputMasks (pWin))
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
return BadAlloc;
bzero((char *) &others->mask[0], sizeof(Mask)*EMASKSIZE);
bzero((char *)&others->mask[0], sizeof(Mask) * EMASKSIZE);
others->mask[mskidx] = mask;
others->resource = FakeClientID(client->index);
others->next = pWin->optional->inputMasks->inputClients;
......@@ -751,29 +751,29 @@ AddExtensionClient (pWin, client, mask, mskidx)
if (!AddResource(others->resource, RT_INPUTCLIENT, (void *)pWin))
return BadAlloc;
return Success;
}
}
static Bool
MakeInputMasks (pWin)
WindowPtr pWin;
{
{
struct _OtherInputMasks *imasks;
imasks = (struct _OtherInputMasks *)
malloc (sizeof (struct _OtherInputMasks));
imasks = (struct _OtherInputMasks *)
malloc(sizeof(struct _OtherInputMasks));
if (!imasks)
return FALSE;
bzero((char *) imasks, sizeof (struct _OtherInputMasks));
bzero((char *)imasks, sizeof(struct _OtherInputMasks));
pWin->optional->inputMasks = imasks;
return TRUE;
}
}
void
RecalculateDeviceDeliverableEvents(pWin)
WindowPtr pWin;
{
{
register InputClientsPtr others;
struct _OtherInputMasks *inputMasks; /* default: NULL */
struct _OtherInputMasks *inputMasks; /* default: NULL */
register WindowPtr pChild, tmp;
int i;
......@@ -782,44 +782,44 @@ RecalculateDeviceDeliverableEvents(pWin)
{
if ((inputMasks = wOtherInputMasks(pChild)) != 0)
{
for (others = inputMasks->inputClients; others;
for (others = inputMasks->inputClients; others;
others = others->next)
{
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
inputMasks->inputEvents[i] |= others->mask[i];
}
for (i=0; i<EMASKSIZE; i++)
}
for (i = 0; i < EMASKSIZE; i++)
inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i];
for (tmp = pChild->parent; tmp; tmp=tmp->parent)
for (tmp = pChild->parent; tmp; tmp = tmp->parent)
if (wOtherInputMasks(tmp))
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
inputMasks->deliverableEvents[i] |=
(wOtherInputMasks(tmp)->deliverableEvents[i]
(wOtherInputMasks(tmp)->deliverableEvents[i]
& ~inputMasks->dontPropagateMask[i] & PropagateMask[i]);
}
}
if (pChild->firstChild)
{
pChild = pChild->firstChild;
continue;
}
}
while (!pChild->nextSib && (pChild != pWin))
pChild = pChild->parent;
if (pChild == pWin)
break;
pChild = pChild->nextSib;
}
}
}
int
InputClientGone(pWin, id)
register WindowPtr pWin;
XID id;
{
{
register InputClientsPtr other, prev;
if (!wOtherInputMasks(pWin))
return(Success);
return (Success);
prev = 0;
for (other = wOtherInputMasks(pWin)->inputClients; other;
for (other = wOtherInputMasks(pWin)->inputClients; other;
other = other->next)
{
if (other->resource == id)
......@@ -836,30 +836,30 @@ InputClientGone(pWin, id)
wOtherInputMasks(pWin)->inputClients = other->next;
free(wOtherInputMasks(pWin));
pWin->optional->inputMasks = (OtherInputMasks *) NULL;
CheckWindowOptionalNeed (pWin);
CheckWindowOptionalNeed(pWin);
free(other);
}
else
{
other->resource = FakeClientID(0);
if (!AddResource(other->resource, RT_INPUTCLIENT,
(void *)pWin))
if (!AddResource(other->resource, RT_INPUTCLIENT,
(void *) pWin))
return BadAlloc;
}
}
}
else
{
wOtherInputMasks(pWin)->inputClients = other->next;
free(other);
}
RecalculateDeviceDeliverableEvents(pWin);
return(Success);
}
RecalculateDeviceDeliverableEvents(pWin);
return (Success);
}
prev = other;
}
}
FatalError("client not on device event list");
/*NOTREACHED*/
}
}
int
SendEvent (client, d, dest, propagate, ev, mask, count)
......@@ -870,17 +870,17 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
xEvent *ev;
Mask mask;
int count;
{
{
WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr spriteWin=GetSpriteWindow();
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr spriteWin = GetSpriteWindow();
if (dest == PointerWindow)
pWin = spriteWin;
else if (dest == InputFocus)
{
WindowPtr inputFocus;
if (!d->focus)
inputFocus = spriteWin;
else
......@@ -894,7 +894,7 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
/* If the input focus is PointerRootWin, send the event to where
the pointer is if possible, then perhaps propogate up to root. */
if (inputFocus == PointerRootWin)
if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow();
if (IsParent(inputFocus, spriteWin))
......@@ -919,7 +919,7 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
{
for (;pWin; pWin = pWin->parent)
{
if (DeliverEventsToWindow( pWin, ev, count, mask, NullGrab, d->id))
if (DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id))
return Success;
if (pWin == effectiveFocus)
return Success;
......@@ -930,9 +930,9 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
}
}
else
(void)(DeliverEventsToWindow( pWin, ev, count, mask, NullGrab, d->id));
(void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id));
return Success;
}
}
int
SetButtonMapping (client, dev, nElts, map)
......@@ -940,7 +940,7 @@ SetButtonMapping (client, dev, nElts, map)
DeviceIntPtr dev;
int nElts;
BYTE *map;
{
{
register int i;
ButtonClassPtr b = dev->button;
......@@ -954,16 +954,16 @@ SetButtonMapping (client, dev, nElts, map)
}
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
return BadValue;
for (i=0; i < nElts; i++)
for (i = 0; i < nElts; i++)
if ((b->map[i + 1] != map[i]) &&
BitIsOn(b->down, i + 1))
return MappingBusy;
return MappingBusy;
for (i = 0; i < nElts; i++)
b->map[i + 1] = map[i];
return Success;
}
}
int
int
SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
ClientPtr client;
DeviceIntPtr dev;
......@@ -976,36 +976,36 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
KeyCode *map = NULL;
int inputMapLen;
register int i;
*k = dev->key;
if (*k == NULL)
return BadMatch;
if (len != ((numKeyPerModifier<<1) + rlen))
if (len != ((numKeyPerModifier << 1) + rlen))
return BadLength;
inputMapLen = 8*numKeyPerModifier;
inputMapLen = 8 * numKeyPerModifier;
/*
* Now enforce the restriction that "all of the non-zero keycodes must be
* in the range specified by min-keycode and max-keycode in the
* connection setup (else a Value error)"
* Now enforce the restriction that "all of the non-zero keycodes must be
* in the range specified by min-keycode and max-keycode in the
* connection setup (else a Value error)"
*/
i = inputMapLen;
while (i--) {
if (inputMap[i]
&& (inputMap[i] < (*k)->curKeySyms.minKeyCode
|| inputMap[i] > (*k)->curKeySyms.maxKeyCode)) {
client->errorValue = inputMap[i];
return -1; /* BadValue collides with MappingFailed */
}
client->errorValue = inputMap[i];
return -1; /* BadValue collides with MappingFailed */
}
}
/*
* Now enforce the restriction that none of the old or new
* modifier keys may be down while we change the mapping, and
* that the DDX layer likes the choice.
* Now enforce the restriction that none of the old or new
* modifier keys may be down while we change the mapping, and
* that the DDX layer likes the choice.
*/
if (!AllModifierKeysAreUp (dev, (*k)->modifierKeyMap,
if (!AllModifierKeysAreUp(dev, (*k)->modifierKeyMap,
(int)(*k)->maxKeysPerModifier, inputMap, (int)numKeyPerModifier)
||
!AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier,
......@@ -1013,39 +1013,39 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
return MappingBusy;
} else {
for (i = 0; i < inputMapLen; i++) {
if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)dev)) {
if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr) dev)) {
return MappingFailed;
}
}
}
/*
* Now build the keyboard's modifier bitmap from the
* list of keycodes.
* Now build the keyboard's modifier bitmap from the
* list of keycodes.
*/
if (inputMapLen) {
map = (KeyCode *)malloc(inputMapLen);
if (!map)
return BadAlloc;
map = (KeyCode *) malloc(inputMapLen);
if (!map)
return BadAlloc;
}
if ((*k)->modifierKeyMap)
free((*k)->modifierKeyMap);
free((*k)->modifierKeyMap);
if (inputMapLen) {
(*k)->modifierKeyMap = map;
memmove((char *)(*k)->modifierKeyMap, (char *)inputMap, inputMapLen);
(*k)->modifierKeyMap = map;
memmove((char *)(*k)->modifierKeyMap, (char *)inputMap, inputMapLen);
} else
(*k)->modifierKeyMap = NULL;
(*k)->maxKeysPerModifier = numKeyPerModifier;
for (i = 0; i < MAP_LENGTH; i++)
(*k)->modifierMap[i] = 0;
(*k)->modifierMap[i] = 0;
for (i = 0; i < inputMapLen; i++) if (inputMap[i]) {
(*k)->modifierMap[inputMap[i]]
|= (1<<(i/ (*k)->maxKeysPerModifier));
}
(*k)->modifierMap[inputMap[i]]
|= (1 << (i / (*k)->maxKeysPerModifier));
}
return(MappingSuccess);
}
return (MappingSuccess);
}
void
SendDeviceMappingNotify(
......@@ -1055,7 +1055,7 @@ SendDeviceMappingNotify(
DeviceIntPtr dev)
{
xEvent event;
deviceMappingNotify *ev = (deviceMappingNotify *) &event;
deviceMappingNotify *ev = (deviceMappingNotify *) & event;
ev->type = DeviceMappingNotify;
ev->request = request;
......@@ -1065,18 +1065,18 @@ SendDeviceMappingNotify(
{
ev->firstKeyCode = firstKeyCode;
ev->count = count;
}
SendEventToAllWindows (dev, DeviceMappingNotifyMask, (xEvent *)ev, 1);
}
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1);
}
int
ChangeKeyMapping(
ClientPtr client,
DeviceIntPtr dev,
unsigned len,
int type,
KeyCode firstKeyCode,
DeviceIntPtr dev,
unsigned len,
int type,
KeyCode firstKeyCode,
CARD8 keyCodes,
CARD8 keySymsPerKeyCode,
KeySym *map)
......@@ -1088,18 +1088,18 @@ ChangeKeyMapping(
return (BadMatch);
if (len != (keyCodes * keySymsPerKeyCode))
return BadLength;
return BadLength;
if ((firstKeyCode < k->curKeySyms.minKeyCode) ||
(firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode))
{
client->errorValue = firstKeyCode;
return BadValue;
client->errorValue = firstKeyCode;
return BadValue;
}
if (keySymsPerKeyCode == 0)
{
client->errorValue = 0;
return BadValue;
client->errorValue = 0;
return BadValue;
}
keysyms.minKeyCode = firstKeyCode;
keysyms.maxKeyCode = firstKeyCode + keyCodes - 1;
......@@ -1110,16 +1110,16 @@ ChangeKeyMapping(
SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes,
dev);
return client->noClientException;
}
}
void
DeleteWindowFromAnyExtEvents(pWin, freeResources)
WindowPtr pWin;
Bool freeResources;
{
int i;
DeviceIntPtr dev;
InputClientsPtr ic;
{
int i;
DeviceIntPtr dev;
InputClientsPtr ic;
struct _OtherInputMasks *inputMasks;
for (dev=inputInfo.devices; dev; dev=dev->next)
......@@ -1128,115 +1128,115 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
dev == inputInfo.keyboard)
continue;
DeleteDeviceFromAnyExtEvents(pWin, dev);
}
}
for (dev=inputInfo.off_devices; dev; dev=dev->next)
for (dev = inputInfo.off_devices; dev; dev = dev->next)
DeleteDeviceFromAnyExtEvents(pWin, dev);
if (freeResources)
while ((inputMasks = wOtherInputMasks(pWin)) != 0)
{
ic = inputMasks->inputClients;
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
inputMasks->dontPropagateMask[i] = 0;
FreeResource(ic->resource, RT_NONE);
}
}
}
}
void
DeleteDeviceFromAnyExtEvents(pWin, dev)
WindowPtr pWin;
DeviceIntPtr dev;
{
WindowPtr parent;
{
WindowPtr parent;
/* Deactivate any grabs performed on this window, before making
any input focus changes.
Deactivating a device grab should cause focus events. */
if (dev->grab && (dev->grab->window == pWin))
(*dev->DeactivateGrab)(dev);
(*dev->DeactivateGrab) (dev);
/* If the focus window is a root window (ie. has no parent)
then don't delete the focus from it. */
if (dev->focus && (pWin==dev->focus->win) && (pWin->parent != NullWindow))
{
int focusEventMode = NotifyNormal;
/* If a grab is in progress, then alter the mode of focus events. */
/* If a grab is in progress, then alter the mode of focus events. */
if (dev->grab)
focusEventMode = NotifyWhileGrabbed;
switch (dev->focus->revert)
{
case RevertToNone:
DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
dev->focus->win = NoneWin;
dev->focus->traceGood = 0;
break;
case RevertToParent:
parent = pWin;
case RevertToNone:
DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
dev->focus->win = NoneWin;
dev->focus->traceGood = 0;
break;
case RevertToParent:
parent = pWin;
do
{
parent = parent->parent;
dev->focus->traceGood--;
parent = parent->parent;
dev->focus->traceGood--;
} while (!parent->realized);
DoFocusEvents(dev, pWin, parent, focusEventMode);
dev->focus->win = parent;
dev->focus->revert = RevertToNone;
break;
case RevertToPointerRoot:
DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode);
dev->focus->win = PointerRootWin;
DoFocusEvents(dev, pWin, parent, focusEventMode);
dev->focus->win = parent;
dev->focus->revert = RevertToNone;
break;
case RevertToPointerRoot:
DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode);
dev->focus->win = PointerRootWin;
dev->focus->traceGood = 0;
break;
case RevertToFollowKeyboard:
if (inputInfo.keyboard->focus->win) {
DoFocusEvents(dev, pWin, inputInfo.keyboard->focus->win,
focusEventMode);
dev->focus->win = FollowKeyboardWin;
dev->focus->traceGood = 0;
} else {
DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
dev->focus->win = NoneWin;
dev->focus->traceGood = 0;
break;
case RevertToFollowKeyboard:
if (inputInfo.keyboard->focus->win) {
DoFocusEvents(dev, pWin, inputInfo.keyboard->focus->win,
focusEventMode);
dev->focus->win = FollowKeyboardWin;
dev->focus->traceGood = 0;
} else {
DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
dev->focus->win = NoneWin;
dev->focus->traceGood = 0;
}
break;
}
break;
}
}
if (dev->valuator)
if (dev->valuator->motionHintWindow == pWin)
dev->valuator->motionHintWindow = NullWindow;
}
}
int
MaybeSendDeviceMotionNotifyHint (pEvents, mask)
deviceKeyButtonPointer *pEvents;
Mask mask;
{
{
DeviceIntPtr dev;
dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS);
dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS);
if (pEvents->type == DeviceMotionNotify)
{
if (mask & DevicePointerMotionHintMask)
{
if (WID(dev->valuator->motionHintWindow) == pEvents->event)
{
return 1; /* don't send, but pretend we did */
}
return 1; /* don't send, but pretend we did */
}
pEvents->detail = NotifyHint;
}
else
{
pEvents->detail = NotifyNormal;
}
}
return (0);
}
return (0);
}
void
CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
......@@ -1246,13 +1246,13 @@ CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
GrabPtr grab;
ClientPtr client;
Mask deliveryMask;
{
{
DeviceIntPtr dev;
dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS);
dev = LookupDeviceIntRec(xE->deviceid & DEVICE_BITS);
if (type == DeviceMotionNotify)
dev->valuator->motionHintWindow = pWin;
else if ((type == DeviceButtonPress) && (!grab) &&
else if ((type == DeviceButtonPress) && (!grab) &&
(deliveryMask & DeviceButtonGrabMask))
{
GrabRec tempGrab;
......@@ -1266,28 +1266,28 @@ CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
tempGrab.pointerMode = GrabModeAsync;
tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor;
(*dev->ActivateGrab)(dev, &tempGrab, currentTime, TRUE);
}
(*dev->ActivateGrab) (dev, &tempGrab, currentTime, TRUE);
}
}
Mask
DeviceEventMaskForClient(dev, pWin, client)
DeviceIntPtr dev;
WindowPtr pWin;
ClientPtr client;
{
{
register InputClientsPtr other;
if (!wOtherInputMasks(pWin))
return 0;
for (other = wOtherInputMasks(pWin)->inputClients; other;
for (other = wOtherInputMasks(pWin)->inputClients; other;
other = other->next)
{
if (SameClient(other, client))
return other->mask[dev->id];
}
return 0;
}
return 0;
}
void
MaybeStopDeviceHint(dev, client)
......@@ -1305,7 +1305,7 @@ MaybeStopDeviceHint(dev, client)
DevicePointerMotionHintMask)))) ||
(!grab &&
(DeviceEventMaskForClient(dev, pWin, client) &
DevicePointerMotionHintMask)))
DevicePointerMotionHintMask)))
dev->valuator->motionHintWindow = NullWindow;
}
......@@ -1315,14 +1315,14 @@ DeviceEventSuppressForWindow(pWin, client, mask, maskndx)
ClientPtr client;
Mask mask;
int maskndx;
{
struct _OtherInputMasks *inputMasks = wOtherInputMasks (pWin);
{
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
if (mask & ~PropagateMask[maskndx])
{
client->errorValue = mask;
return BadValue;
}
}
if (mask == 0)
{
......@@ -1332,32 +1332,32 @@ DeviceEventSuppressForWindow(pWin, client, mask, maskndx)
else
{
if (!inputMasks)
AddExtensionClient (pWin, client, 0, 0);
AddExtensionClient(pWin, client, 0, 0);
inputMasks = wOtherInputMasks(pWin);
inputMasks->dontPropagateMask[maskndx] = mask;
}
}
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, RT_NONE);
FreeResource(inputMasks->inputClients->resource, RT_NONE);
return Success;
}
}
static Bool
ShouldFreeInputMasks (pWin, ignoreSelectedEvents)
WindowPtr pWin;
Bool ignoreSelectedEvents;
{
{
int i;
Mask allInputEventMasks = 0;
struct _OtherInputMasks *inputMasks = wOtherInputMasks (pWin);
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
allInputEventMasks |= inputMasks->dontPropagateMask[i];
if (!ignoreSelectedEvents)
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
allInputEventMasks |= inputMasks->inputEvents[i];
if (allInputEventMasks == 0)
return TRUE;
else
return FALSE;
}
}
......@@ -35,45 +35,45 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef EXGLOBALS_H
#define EXGLOBALS_H 1
extern int IReqCode;
extern int BadDevice;
extern int BadEvent;
extern int BadMode;
extern int DeviceBusy;
extern int BadClass;
extern int IReqCode;
extern int BadDevice;
extern int BadEvent;
extern int BadMode;
extern int DeviceBusy;
extern int BadClass;
extern Mask DevicePointerMotionMask;
extern Mask DevicePointerMotionHintMask;
extern Mask DeviceFocusChangeMask;
extern Mask DeviceStateNotifyMask;
extern Mask ChangeDeviceNotifyMask;
extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask;
extern Mask DeviceButtonMotionMask;
extern Mask PropagateMask[];
extern Mask DevicePointerMotionMask;
extern Mask DevicePointerMotionHintMask;
extern Mask DeviceFocusChangeMask;
extern Mask DeviceStateNotifyMask;
extern Mask ChangeDeviceNotifyMask;
extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask;
extern Mask DeviceButtonMotionMask;
extern Mask PropagateMask[];
extern int DeviceValuator;
extern int DeviceKeyPress;
extern int DeviceKeyRelease;
extern int DeviceButtonPress;
extern int DeviceButtonRelease;
extern int DeviceMotionNotify;
extern int DeviceFocusIn;
extern int DeviceFocusOut;
extern int ProximityIn;
extern int ProximityOut;
extern int DeviceStateNotify;
extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify;
extern int DeviceMappingNotify;
extern int ChangeDeviceNotify;
extern int DeviceValuator;
extern int DeviceKeyPress;
extern int DeviceKeyRelease;
extern int DeviceButtonPress;
extern int DeviceButtonRelease;
extern int DeviceMotionNotify;
extern int DeviceFocusIn;
extern int DeviceFocusOut;
extern int ProximityIn;
extern int ProximityOut;
extern int DeviceStateNotify;
extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify;
extern int DeviceMappingNotify;
extern int ChangeDeviceNotify;
extern int RT_INPUTCLIENT;
extern int RT_INPUTCLIENT;
#if 0
/* FIXME: in dix */
extern InputInfo inputInfo;
extern InputInfo inputInfo;
#endif
#endif /* EXGLOBALS_H */
......@@ -111,15 +111,15 @@ SOFTWARE.
#include "ungrdevb.h"
#include "ungrdevk.h"
static Mask lastExtEventMask = 1;
int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE];
Mask ExtExclusiveMasks[EMASKSIZE];
struct dev_type
{
Atom type;
char *name;
static Mask lastExtEventMask = 1;
int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE];
Mask ExtExclusiveMasks[EMASKSIZE];
struct dev_type
{
Atom type;
char *name;
}dev_type [] = {{0,XI_KEYBOARD},
{0,XI_MOUSE},
{0,XI_TABLET},
......@@ -139,7 +139,7 @@ struct dev_type
{0,XI_CURSORKEYS},
{0,XI_FOOTMOUSE}};
CARD8 event_base [numInputClasses];
CARD8 event_base[numInputClasses];
XExtEventInfo EventInfo[32];
/*****************************************************************
......@@ -148,40 +148,40 @@ XExtEventInfo EventInfo[32];
*
*/
int IReqCode = 0;
int BadDevice = 0;
int BadEvent = 1;
int BadMode = 2;
int DeviceBusy = 3;
int BadClass = 4;
Mask DevicePointerMotionMask;
Mask DevicePointerMotionHintMask;
Mask DeviceFocusChangeMask;
Mask DeviceStateNotifyMask;
Mask ChangeDeviceNotifyMask;
Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask;
Mask DeviceButtonMotionMask;
int DeviceValuator;
int DeviceKeyPress;
int DeviceKeyRelease;
int DeviceButtonPress;
int DeviceButtonRelease;
int DeviceMotionNotify;
int DeviceFocusIn;
int DeviceFocusOut;
int ProximityIn;
int ProximityOut;
int DeviceStateNotify;
int DeviceKeyStateNotify;
int DeviceButtonStateNotify;
int DeviceMappingNotify;
int ChangeDeviceNotify;
int RT_INPUTCLIENT;
int IReqCode = 0;
int BadDevice = 0;
int BadEvent = 1;
int BadMode = 2;
int DeviceBusy = 3;
int BadClass = 4;
Mask DevicePointerMotionMask;
Mask DevicePointerMotionHintMask;
Mask DeviceFocusChangeMask;
Mask DeviceStateNotifyMask;
Mask ChangeDeviceNotifyMask;
Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask;
Mask DeviceButtonMotionMask;
int DeviceValuator;
int DeviceKeyPress;
int DeviceKeyRelease;
int DeviceButtonPress;
int DeviceButtonRelease;
int DeviceMotionNotify;
int DeviceFocusIn;
int DeviceFocusOut;
int ProximityIn;
int ProximityOut;
int DeviceStateNotify;
int DeviceKeyStateNotify;
int DeviceButtonStateNotify;
int DeviceMappingNotify;
int ChangeDeviceNotify;
int RT_INPUTCLIENT;
/*****************************************************************
*
......@@ -189,9 +189,9 @@ int RT_INPUTCLIENT;
*
*/
extern XExtensionVersion AllExtensionVersions[];
extern XExtensionVersion AllExtensionVersions[];
Mask PropagateMask[MAX_DEVICES];
Mask PropagateMask[MAX_DEVICES];
/*****************************************************************
*
......@@ -201,9 +201,9 @@ Mask PropagateMask[MAX_DEVICES];
static XExtensionVersion thisversion =
{XI_Present,
SERVER_XI_MAJOR_VERSION,
SERVER_XI_MINOR_VERSION,
};
SERVER_XI_MAJOR_VERSION,
SERVER_XI_MINOR_VERSION,
};
/**********************************************************************
*
......@@ -222,15 +222,15 @@ XInputExtensionInit()
ExtensionEntry *extEntry;
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry)
{
IReqCode = extEntry->base;
AllExtensionVersions[IReqCode-128] = thisversion;
MakeDeviceTypeAtoms ();
RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone);
FixExtensionEvents (extEntry);
ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch;
AllExtensionVersions[IReqCode - 128] = thisversion;
MakeDeviceTypeAtoms();
RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
FixExtensionEvents(extEntry);
ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
......@@ -250,8 +250,8 @@ XInputExtensionInit()
else
{
FatalError("IExtensionInit: AddExtensions failed\n");
}
}
}
/*************************************************************************
*
......@@ -266,81 +266,81 @@ ProcIDispatch (client)
{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(ProcXGetExtensionVersion(client));
return (ProcXGetExtensionVersion(client));
if (stuff->data == X_ListInputDevices)
return(ProcXListInputDevices(client));
return (ProcXListInputDevices(client));
else if (stuff->data == X_OpenDevice)
return(ProcXOpenDevice(client));
return (ProcXOpenDevice(client));
else if (stuff->data == X_CloseDevice)
return(ProcXCloseDevice(client));
return (ProcXCloseDevice(client));
else if (stuff->data == X_SetDeviceMode)
return(ProcXSetDeviceMode(client));
return (ProcXSetDeviceMode(client));
else if (stuff->data == X_SelectExtensionEvent)
return(ProcXSelectExtensionEvent(client));
return (ProcXSelectExtensionEvent(client));
else if (stuff->data == X_GetSelectedExtensionEvents)
return(ProcXGetSelectedExtensionEvents(client));
return (ProcXGetSelectedExtensionEvents(client));
else if (stuff->data == X_ChangeDeviceDontPropagateList)
return(ProcXChangeDeviceDontPropagateList(client));
return (ProcXChangeDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceDontPropagateList)
return(ProcXGetDeviceDontPropagateList(client));
return (ProcXGetDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceMotionEvents)
return(ProcXGetDeviceMotionEvents(client));
return (ProcXGetDeviceMotionEvents(client));
else if (stuff->data == X_ChangeKeyboardDevice)
return(ProcXChangeKeyboardDevice(client));
return (ProcXChangeKeyboardDevice(client));
else if (stuff->data == X_ChangePointerDevice)
return(ProcXChangePointerDevice(client));
return (ProcXChangePointerDevice(client));
else if (stuff->data == X_GrabDevice)
return(ProcXGrabDevice(client));
return (ProcXGrabDevice(client));
else if (stuff->data == X_UngrabDevice)
return(ProcXUngrabDevice(client));
return (ProcXUngrabDevice(client));
else if (stuff->data == X_GrabDeviceKey)
return(ProcXGrabDeviceKey(client));
return (ProcXGrabDeviceKey(client));
else if (stuff->data == X_UngrabDeviceKey)
return(ProcXUngrabDeviceKey(client));
return (ProcXUngrabDeviceKey(client));
else if (stuff->data == X_GrabDeviceButton)
return(ProcXGrabDeviceButton(client));
return (ProcXGrabDeviceButton(client));
else if (stuff->data == X_UngrabDeviceButton)
return(ProcXUngrabDeviceButton(client));
return (ProcXUngrabDeviceButton(client));
else if (stuff->data == X_AllowDeviceEvents)
return(ProcXAllowDeviceEvents(client));
return (ProcXAllowDeviceEvents(client));
else if (stuff->data == X_GetDeviceFocus)
return(ProcXGetDeviceFocus(client));
return (ProcXGetDeviceFocus(client));
else if (stuff->data == X_SetDeviceFocus)
return(ProcXSetDeviceFocus(client));
return (ProcXSetDeviceFocus(client));
else if (stuff->data == X_GetFeedbackControl)
return(ProcXGetFeedbackControl(client));
return (ProcXGetFeedbackControl(client));
else if (stuff->data == X_ChangeFeedbackControl)
return(ProcXChangeFeedbackControl(client));
return (ProcXChangeFeedbackControl(client));
else if (stuff->data == X_GetDeviceKeyMapping)
return(ProcXGetDeviceKeyMapping(client));
return (ProcXGetDeviceKeyMapping(client));
else if (stuff->data == X_ChangeDeviceKeyMapping)
return(ProcXChangeDeviceKeyMapping(client));
return (ProcXChangeDeviceKeyMapping(client));
else if (stuff->data == X_GetDeviceModifierMapping)
return(ProcXGetDeviceModifierMapping(client));
return (ProcXGetDeviceModifierMapping(client));
else if (stuff->data == X_SetDeviceModifierMapping)
return(ProcXSetDeviceModifierMapping(client));
return (ProcXSetDeviceModifierMapping(client));
else if (stuff->data == X_GetDeviceButtonMapping)
return(ProcXGetDeviceButtonMapping(client));
return (ProcXGetDeviceButtonMapping(client));
else if (stuff->data == X_SetDeviceButtonMapping)
return(ProcXSetDeviceButtonMapping(client));
return (ProcXSetDeviceButtonMapping(client));
else if (stuff->data == X_QueryDeviceState)
return(ProcXQueryDeviceState(client));
return (ProcXQueryDeviceState(client));
else if (stuff->data == X_SendExtensionEvent)
return(ProcXSendExtensionEvent(client));
return (ProcXSendExtensionEvent(client));
else if (stuff->data == X_DeviceBell)
return(ProcXDeviceBell(client));
return (ProcXDeviceBell(client));
else if (stuff->data == X_SetDeviceValuators)
return(ProcXSetDeviceValuators(client));
return (ProcXSetDeviceValuators(client));
else if (stuff->data == X_GetDeviceControl)
return(ProcXGetDeviceControl(client));
return (ProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl)
return(ProcXChangeDeviceControl(client));
return (ProcXChangeDeviceControl(client));
else
{
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return(BadRequest);
}
return (BadRequest);
}
/*******************************************************************************
*
......@@ -357,81 +357,81 @@ SProcIDispatch(client)
{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(SProcXGetExtensionVersion(client));
return (SProcXGetExtensionVersion(client));
if (stuff->data == X_ListInputDevices)
return(SProcXListInputDevices(client));
return (SProcXListInputDevices(client));
else if (stuff->data == X_OpenDevice)
return(SProcXOpenDevice(client));
return (SProcXOpenDevice(client));
else if (stuff->data == X_CloseDevice)
return(SProcXCloseDevice(client));
return (SProcXCloseDevice(client));
else if (stuff->data == X_SetDeviceMode)
return(SProcXSetDeviceMode(client));
return (SProcXSetDeviceMode(client));
else if (stuff->data == X_SelectExtensionEvent)
return(SProcXSelectExtensionEvent(client));
return (SProcXSelectExtensionEvent(client));
else if (stuff->data == X_GetSelectedExtensionEvents)
return(SProcXGetSelectedExtensionEvents(client));
return (SProcXGetSelectedExtensionEvents(client));
else if (stuff->data == X_ChangeDeviceDontPropagateList)
return(SProcXChangeDeviceDontPropagateList(client));
return (SProcXChangeDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceDontPropagateList)
return(SProcXGetDeviceDontPropagateList(client));
return (SProcXGetDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceMotionEvents)
return(SProcXGetDeviceMotionEvents(client));
return (SProcXGetDeviceMotionEvents(client));
else if (stuff->data == X_ChangeKeyboardDevice)
return(SProcXChangeKeyboardDevice(client));
return (SProcXChangeKeyboardDevice(client));
else if (stuff->data == X_ChangePointerDevice)
return(SProcXChangePointerDevice(client));
return (SProcXChangePointerDevice(client));
else if (stuff->data == X_GrabDevice)
return(SProcXGrabDevice(client));
return (SProcXGrabDevice(client));
else if (stuff->data == X_UngrabDevice)
return(SProcXUngrabDevice(client));
return (SProcXUngrabDevice(client));
else if (stuff->data == X_GrabDeviceKey)
return(SProcXGrabDeviceKey(client));
return (SProcXGrabDeviceKey(client));
else if (stuff->data == X_UngrabDeviceKey)
return(SProcXUngrabDeviceKey(client));
return (SProcXUngrabDeviceKey(client));
else if (stuff->data == X_GrabDeviceButton)
return(SProcXGrabDeviceButton(client));
return (SProcXGrabDeviceButton(client));
else if (stuff->data == X_UngrabDeviceButton)
return(SProcXUngrabDeviceButton(client));
return (SProcXUngrabDeviceButton(client));
else if (stuff->data == X_AllowDeviceEvents)
return(SProcXAllowDeviceEvents(client));
return (SProcXAllowDeviceEvents(client));
else if (stuff->data == X_GetDeviceFocus)
return(SProcXGetDeviceFocus(client));
return (SProcXGetDeviceFocus(client));
else if (stuff->data == X_SetDeviceFocus)
return(SProcXSetDeviceFocus(client));
return (SProcXSetDeviceFocus(client));
else if (stuff->data == X_GetFeedbackControl)
return(SProcXGetFeedbackControl(client));
return (SProcXGetFeedbackControl(client));
else if (stuff->data == X_ChangeFeedbackControl)
return(SProcXChangeFeedbackControl(client));
return (SProcXChangeFeedbackControl(client));
else if (stuff->data == X_GetDeviceKeyMapping)
return(SProcXGetDeviceKeyMapping(client));
return (SProcXGetDeviceKeyMapping(client));
else if (stuff->data == X_ChangeDeviceKeyMapping)
return(SProcXChangeDeviceKeyMapping(client));
return (SProcXChangeDeviceKeyMapping(client));
else if (stuff->data == X_GetDeviceModifierMapping)
return(SProcXGetDeviceModifierMapping(client));
return (SProcXGetDeviceModifierMapping(client));
else if (stuff->data == X_SetDeviceModifierMapping)
return(SProcXSetDeviceModifierMapping(client));
return (SProcXSetDeviceModifierMapping(client));
else if (stuff->data == X_GetDeviceButtonMapping)
return(SProcXGetDeviceButtonMapping(client));
return (SProcXGetDeviceButtonMapping(client));
else if (stuff->data == X_SetDeviceButtonMapping)
return(SProcXSetDeviceButtonMapping(client));
return (SProcXSetDeviceButtonMapping(client));
else if (stuff->data == X_QueryDeviceState)
return(SProcXQueryDeviceState(client));
return (SProcXQueryDeviceState(client));
else if (stuff->data == X_SendExtensionEvent)
return(SProcXSendExtensionEvent(client));
return (SProcXSendExtensionEvent(client));
else if (stuff->data == X_DeviceBell)
return(SProcXDeviceBell(client));
return (SProcXDeviceBell(client));
else if (stuff->data == X_SetDeviceValuators)
return(SProcXSetDeviceValuators(client));
return (SProcXSetDeviceValuators(client));
else if (stuff->data == X_GetDeviceControl)
return(SProcXGetDeviceControl(client));
return (SProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl)
return(SProcXChangeDeviceControl(client));
return (SProcXChangeDeviceControl(client));
else
{
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return(BadRequest);
}
return (BadRequest);
}
/**********************************************************************
*
......@@ -450,15 +450,15 @@ SReplyIDispatch (client, len, rep)
ClientPtr client;
int len;
xGrabDeviceReply *rep; /* All we look at is the type field */
{ /* This is common to all replies */
{ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep);
else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep);
SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep);
SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep);
SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
......@@ -470,11 +470,11 @@ SReplyIDispatch (client, len, rep)
else if (rep->RepType == X_ChangePointerDevice)
SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep);
else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep);
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep);
SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep);
SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
......@@ -486,18 +486,18 @@ SReplyIDispatch (client, len, rep)
else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep);
SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep);
SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep);
SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep);
else
{
FatalError("XINPUT confused sending swapped reply");
}
FatalError("XINPUT confused sending swapped reply");
}
}
/*****************************************************************************
*
......@@ -512,64 +512,64 @@ SEventIDispatch (from, to)
xEvent *from;
xEvent *to;
{
int type = from->u.u.type & 0177;
int type = from->u.u.type & 0177;
if (type == DeviceValuator)
DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceKeyRelease)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceButtonPress)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceButtonRelease)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceMotionNotify)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceFocusIn)
DO_SWAP(SEventFocus, deviceFocus);
DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut)
DO_SWAP(SEventFocus, deviceFocus);
DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == ProximityOut)
{
SKeyButtonPtrEvent (from, to);
SKeyButtonPtrEvent(from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceStateNotify)
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify)
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify)
DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify)
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify)
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else
{
FatalError("XInputExtension: Impossible event!\n");
}
}
}
/************************************************************************
*
......@@ -581,8 +581,8 @@ void
SEventDeviceValuator (from, to)
deviceValuator *from;
deviceValuator *to;
{
register int i;
{
register int i;
INT32 *ip B32;
*to = *from;
......@@ -591,9 +591,9 @@ SEventDeviceValuator (from, to)
ip = &to->valuator0;
for (i=0; i<6; i++)
{
swapl((ip+i)); /* macro - braces are required */
}
swapl((ip + i)); /* macro - braces are required */
}
}
void
SEventFocus (from, to)
......@@ -604,14 +604,14 @@ SEventFocus (from, to)
swaps(&to->sequenceNumber);
swapl(&to->time);
swapl(&to->window);
}
}
void
SDeviceStateNotifyEvent (from, to)
deviceStateNotify *from;
deviceStateNotify *to;
{
register int i;
register int i;
INT32 *ip B32;
*to = *from;
......@@ -620,9 +620,9 @@ SDeviceStateNotifyEvent (from, to)
ip = &to->valuator0;
for (i=0; i<3; i++)
{
swapl((ip+i)); /* macro - braces are required */
}
swapl((ip + i)); /* macro - braces are required */
}
}
void
SDeviceKeyStateNotifyEvent (from, to)
......@@ -631,7 +631,7 @@ SDeviceKeyStateNotifyEvent (from, to)
{
*to = *from;
swaps(&to->sequenceNumber);
}
}
void
SDeviceButtonStateNotifyEvent (from, to)
......@@ -640,7 +640,7 @@ SDeviceButtonStateNotifyEvent (from, to)
{
*to = *from;
swaps(&to->sequenceNumber);
}
}
void
SChangeDeviceNotifyEvent (from, to)
......@@ -650,7 +650,7 @@ SChangeDeviceNotifyEvent (from, to)
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->time);
}
}
void
SDeviceMappingNotifyEvent (from, to)
......@@ -660,7 +660,7 @@ SDeviceMappingNotifyEvent (from, to)
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->time);
}
}
/************************************************************************
*
......@@ -672,22 +672,22 @@ void
FixExtensionEvents (extEntry)
ExtensionEntry *extEntry;
{
Mask mask;
DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1;
DeviceKeyRelease = DeviceKeyPress + 1;
DeviceButtonPress = DeviceKeyRelease + 1;
DeviceButtonRelease = DeviceButtonPress + 1;
DeviceMotionNotify = DeviceButtonRelease + 1;
DeviceFocusIn = DeviceMotionNotify + 1;
DeviceFocusOut = DeviceFocusIn + 1;
ProximityIn = DeviceFocusOut + 1;
ProximityOut = ProximityIn + 1;
DeviceStateNotify = ProximityOut + 1;
DeviceMappingNotify = DeviceStateNotify + 1;
ChangeDeviceNotify = DeviceMappingNotify + 1;
DeviceKeyStateNotify = ChangeDeviceNotify + 1;
Mask mask;
DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1;
DeviceKeyRelease = DeviceKeyPress + 1;
DeviceButtonPress = DeviceKeyRelease + 1;
DeviceButtonRelease = DeviceButtonPress + 1;
DeviceMotionNotify = DeviceButtonRelease + 1;
DeviceFocusIn = DeviceMotionNotify + 1;
DeviceFocusOut = DeviceFocusIn + 1;
ProximityIn = DeviceFocusOut + 1;
ProximityOut = ProximityIn + 1;
DeviceStateNotify = ProximityOut + 1;
DeviceMappingNotify = DeviceStateNotify + 1;
ChangeDeviceNotify = DeviceMappingNotify + 1;
DeviceKeyStateNotify = ChangeDeviceNotify + 1;
DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
event_base[KeyClass] = DeviceKeyPress;
......@@ -703,66 +703,66 @@ FixExtensionEvents (extEntry)
DeviceBusy += extEntry->errorBase;
BadClass += extEntry->errorBase;
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, DeviceKeyPress);
AllowPropagateSuppress (mask);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, DeviceKeyPress);
AllowPropagateSuppress(mask);
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, DeviceKeyRelease);
AllowPropagateSuppress (mask);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, DeviceKeyRelease);
AllowPropagateSuppress(mask);
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, DeviceButtonPress);
AllowPropagateSuppress (mask);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, DeviceButtonPress);
AllowPropagateSuppress(mask);
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, DeviceButtonRelease);
AllowPropagateSuppress (mask);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, DeviceButtonRelease);
AllowPropagateSuppress(mask);
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, ProximityIn);
SetMaskForExtEvent (mask, ProximityOut);
AllowPropagateSuppress (mask);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, ProximityIn);
SetMaskForExtEvent(mask, ProximityOut);
AllowPropagateSuppress(mask);
mask = GetNextExtEventMask ();
mask = GetNextExtEventMask();
DeviceStateNotifyMask = mask;
SetMaskForExtEvent (mask, DeviceStateNotify);
SetMaskForExtEvent(mask, DeviceStateNotify);
mask = GetNextExtEventMask ();
mask = GetNextExtEventMask();
DevicePointerMotionMask = mask;
SetMaskForExtEvent (mask, DeviceMotionNotify);
AllowPropagateSuppress (mask);
SetMaskForExtEvent(mask, DeviceMotionNotify);
AllowPropagateSuppress(mask);
DevicePointerMotionHintMask = GetNextExtEventMask();
SetEventInfo (DevicePointerMotionHintMask, _devicePointerMotionHint);
SetEventInfo (GetNextExtEventMask(), _deviceButton1Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton2Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton3Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton4Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton5Motion);
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
SetEventInfo(GetNextExtEventMask(), _deviceButton1Motion);
SetEventInfo(GetNextExtEventMask(), _deviceButton2Motion);
SetEventInfo(GetNextExtEventMask(), _deviceButton3Motion);
SetEventInfo(GetNextExtEventMask(), _deviceButton4Motion);
SetEventInfo(GetNextExtEventMask(), _deviceButton5Motion);
DeviceButtonMotionMask = GetNextExtEventMask();
SetEventInfo (DeviceButtonMotionMask, _deviceButtonMotion);
SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
DeviceFocusChangeMask = GetNextExtEventMask ();
SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusIn);
SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusOut);
DeviceFocusChangeMask = GetNextExtEventMask();
SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, DeviceMappingNotify);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, DeviceMappingNotify);
DeviceMappingNotifyMask = mask;
mask = GetNextExtEventMask ();
SetMaskForExtEvent (mask, ChangeDeviceNotify);
mask = GetNextExtEventMask();
SetMaskForExtEvent(mask, ChangeDeviceNotify);
ChangeDeviceNotifyMask = mask;
DeviceButtonGrabMask = GetNextExtEventMask();
SetEventInfo (DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess (DeviceButtonGrabMask);
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess(DeviceButtonGrabMask);
DeviceOwnerGrabButtonMask = GetNextExtEventMask();
SetEventInfo (DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo (0, _noExtensionEvent);
}
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo(0, _noExtensionEvent);
}
/************************************************************************
*
......@@ -774,17 +774,17 @@ FixExtensionEvents (extEntry)
void
RestoreExtensionEvents ()
{
int i;
int i;
IReqCode = 0;
for (i=0; i<ExtEventIndex-1; i++)
{
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
SetMaskForEvent(0,EventInfo[i].type);
EventInfo[i].mask = 0;
EventInfo[i].type = 0;
}
SetMaskForEvent(0, EventInfo[i].type);
EventInfo[i].mask = 0;
EventInfo[i].type = 0;
}
ExtEventIndex = 0;
lastExtEventMask = 1;
DeviceValuator = 0;
......@@ -809,7 +809,7 @@ RestoreExtensionEvents ()
DeviceBusy = 3;
BadClass = 4;
}
}
/***********************************************************************
*
......@@ -822,7 +822,7 @@ RestoreExtensionEvents ()
void
IResetProc(unused)
ExtensionEntry *unused;
{
{
ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented;
......@@ -840,8 +840,8 @@ IResetProc(unused)
EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
EventSwapVector[DeviceMappingNotify] = NotImplemented;
EventSwapVector[ChangeDeviceNotify] = NotImplemented;
RestoreExtensionEvents ();
}
RestoreExtensionEvents();
}
/***********************************************************************
*
......@@ -856,9 +856,9 @@ AssignTypeAndName (dev, type, name)
char *name;
{
dev->type = type;
dev->name = (char *) malloc(strlen(name)+1);
strcpy (dev->name, name);
}
dev->name = (char *)malloc(strlen(name) + 1);
strcpy(dev->name, name);
}
/***********************************************************************
*
......@@ -868,13 +868,13 @@ AssignTypeAndName (dev, type, name)
void
MakeDeviceTypeAtoms ()
{
{
int i;
for (i=0; i<NUMTYPES; i++)
dev_type[i].type =
MakeAtom (dev_type[i].name, strlen(dev_type[i].name), 1);
}
for (i = 0; i < NUMTYPES; i++)
dev_type[i].type =
MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
}
/**************************************************************************
*
......@@ -896,10 +896,10 @@ LookupDeviceIntRec (
if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id)
return (NULL);
return (dev);
}
}
return (NULL);
}
return (NULL);
}
/**************************************************************************
*
......@@ -912,12 +912,12 @@ LookupDeviceIntRec (
void
SetExclusiveAccess (mask)
Mask mask;
{
{
int i;
for (i=0; i<MAX_DEVICES; i++)
for (i = 0; i < MAX_DEVICES; i++)
ExtExclusiveMasks[i] |= mask;
}
}
/**************************************************************************
*
......@@ -929,12 +929,12 @@ SetExclusiveAccess (mask)
void
AllowPropagateSuppress (mask)
Mask mask;
{
{
int i;
for (i=0; i<MAX_DEVICES; i++)
for (i = 0; i < MAX_DEVICES; i++)
PropagateMask[i] |= mask;
}
}
/**************************************************************************
*
......@@ -942,22 +942,22 @@ AllowPropagateSuppress (mask)
*
*/
Mask
Mask
GetNextExtEventMask ()
{
{
int i;
Mask mask = lastExtEventMask;
if (lastExtEventMask == 0)
{
FatalError("GetNextExtEventMask: no more events are available.");
}
}
lastExtEventMask <<= 1;
for (i=0; i<MAX_DEVICES; i++)
for (i = 0; i < MAX_DEVICES; i++)
ExtValidMasks[i] |= mask;
return mask;
}
}
/**************************************************************************
*
......@@ -969,15 +969,15 @@ void
SetMaskForExtEvent(mask, event)
Mask mask;
int event;
{
{
EventInfo[ExtEventIndex].mask = mask;
EventInfo[ExtEventIndex++].type = event;
if ((event < LASTEvent) || (event >= 128))
FatalError("MaskForExtensionEvent: bogus event number");
SetMaskForEvent(mask,event);
}
SetMaskForEvent(mask, event);
}
/**************************************************************************
*
......@@ -996,7 +996,7 @@ void
SetEventInfo(mask, constant)
Mask mask;
int constant;
{
{
EventInfo[ExtEventIndex].mask = mask;
EventInfo[ExtEventIndex++].type = constant;
}
}
......@@ -75,11 +75,11 @@ SOFTWARE.
int
SProcXGetDeviceButtonMapping(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length);
return(ProcXGetDeviceButtonMapping(client));
}
return (ProcXGetDeviceButtonMapping(client));
}
/***********************************************************************
*
......@@ -90,10 +90,10 @@ SProcXGetDeviceButtonMapping(client)
int
ProcXGetDeviceButtonMapping (client)
register ClientPtr client;
{
DeviceIntPtr dev;
xGetDeviceButtonMappingReply rep;
ButtonClassPtr b;
{
DeviceIntPtr dev;
xGetDeviceButtonMappingReply rep;
ButtonClassPtr b;
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
......@@ -104,28 +104,28 @@ ProcXGetDeviceButtonMapping (client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
BadDevice);
return Success;
}
}
b = dev->button;
if (b == NULL)
{
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
BadMatch);
return Success;
}
}
rep.nElts = b->numButtons;
rep.length = (rep.nElts + (4-1))/4;
WriteReplyToClient (client, sizeof (xGetDeviceButtonMappingReply), &rep);
rep.length = (rep.nElts + (4 - 1)) / 4;
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts,
(char *)&b->map[1]);
return Success;
}
}
/***********************************************************************
*
......@@ -139,8 +139,8 @@ SRepXGetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;
xGetDeviceButtonMappingReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceButtonMapping(
ClientPtr /* client */
);
);
int
ProcXGetDeviceButtonMapping (
ClientPtr /* client */
);
);
void
SRepXGetDeviceButtonMapping (
ClientPtr /* client */,
int /* size */,
xGetDeviceButtonMappingReply * /* rep */
);
int /* size */ ,
xGetDeviceButtonMappingReply * /* rep */
);
#endif /* GETBMAP_H */
......@@ -76,13 +76,13 @@ SOFTWARE.
int
SProcXGetDeviceControl(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return(ProcXGetDeviceControl(client));
}
return (ProcXGetDeviceControl(client));
}
/***********************************************************************
*
......@@ -93,8 +93,8 @@ SProcXGetDeviceControl(client)
int
ProcXGetDeviceControl(client)
ClientPtr client;
{
int total_length = 0;
{
int total_length = 0;
char *buf, *savbuf;
register DeviceIntPtr dev;
xGetDeviceControlReply rep;
......@@ -102,13 +102,13 @@ ProcXGetDeviceControl(client)
REQUEST(xGetDeviceControlReq);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
BadDevice);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
......@@ -117,47 +117,47 @@ ProcXGetDeviceControl(client)
switch (stuff->control)
{
case DEVICE_RESOLUTION:
case DEVICE_RESOLUTION:
if (!dev->valuator)
{
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
total_length = sizeof (xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
default:
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
BadValue);
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
default:
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
BadValue);
return Success;
}
buf = (char *) malloc (total_length);
buf = (char *)malloc(total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadAlloc);
return Success;
}
savbuf=buf;
}
savbuf = buf;
switch (stuff->control)
{
case DEVICE_RESOLUTION:
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf,
total_length);
break;
default:
break;
}
break;
default:
break;
}
rep.length = (total_length+3) >> 2;
rep.length = (total_length + 3) >> 2;
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
free (savbuf);
free(savbuf);
return Success;
}
}
/***********************************************************************
*
......@@ -171,35 +171,35 @@ CopySwapDeviceResolution (client, v, buf, length)
ValuatorClassPtr v;
char *buf;
int length;
{
AxisInfoPtr a;
{
AxisInfoPtr a;
xDeviceResolutionState *r;
int i, *iptr;
r = (xDeviceResolutionState *) buf;
r->control = DEVICE_RESOLUTION;
r->length = length;
r->num_valuators = v->numAxes;
buf += sizeof (xDeviceResolutionState);
iptr = (int *) buf;
for (i=0,a=v->axes; i<v->numAxes; i++,a++)
r->length = length;
r->num_valuators = v->numAxes;
buf += sizeof(xDeviceResolutionState);
iptr = (int *)buf;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->resolution;
for (i=0,a=v->axes; i<v->numAxes; i++,a++)
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->min_resolution;
for (i=0,a=v->axes; i<v->numAxes; i++,a++)
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->max_resolution;
if (client->swapped)
{
swaps (&r->control);
swaps (&r->length);
swapl (&r->num_valuators);
iptr = (int *) buf;
swaps(&r->control);
swaps(&r->length);
swapl(&r->num_valuators);
iptr = (int *)buf;
for (i=0; i < (3 * v->numAxes); i++,iptr++)
{
swapl (iptr);
}
swapl(iptr);
}
}
}
/***********************************************************************
*
......@@ -213,9 +213,9 @@ SRepXGetDeviceControl (client, size, rep)
ClientPtr client;
int size;
xGetDeviceControlReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,26 +33,26 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceControl (
ClientPtr /* client */
);
);
int
ProcXGetDeviceControl (
ClientPtr /* client */
);
);
void
CopySwapDeviceResolution (
ClientPtr /* client */,
ValuatorClassPtr /* v */,
char * /* buf */,
int /* length */
);
ValuatorClassPtr /* v */ ,
char * /* buf */ ,
int /* length */
);
void
SRepXGetDeviceControl (
ClientPtr /* client */,
int /* size */,
xGetDeviceControlReply * /* rep */
);
int /* size */ ,
xGetDeviceControlReply * /* rep */
);
#endif /* GETDCTL_H */
......@@ -76,11 +76,11 @@ SOFTWARE.
int
SProcXGetFeedbackControl(client)
register ClientPtr client;
{
{
REQUEST(xGetFeedbackControlReq);
swaps(&stuff->length);
return(ProcXGetFeedbackControl(client));
}
return (ProcXGetFeedbackControl(client));
}
/***********************************************************************
*
......@@ -91,8 +91,8 @@ SProcXGetFeedbackControl(client)
int
ProcXGetFeedbackControl(client)
ClientPtr client;
{
int total_length = 0;
{
int total_length = 0;
char *buf, *savbuf;
register DeviceIntPtr dev;
KbdFeedbackPtr k;
......@@ -106,13 +106,13 @@ ProcXGetFeedbackControl(client)
REQUEST(xGetFeedbackControlReq);
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_GetFeedbackControl, 0,
BadDevice);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_GetFeedbackControl;
......@@ -124,69 +124,69 @@ ProcXGetFeedbackControl(client)
{
rep.num_feedbacks++;
total_length += sizeof(xKbdFeedbackState);
}
}
for (p=dev->ptrfeed; p; p=p->next)
{
rep.num_feedbacks++;
total_length += sizeof(xPtrFeedbackState);
}
}
for (s=dev->stringfeed; s; s=s->next)
{
rep.num_feedbacks++;
total_length += sizeof(xStringFeedbackState) +
(s->ctrl.num_symbols_supported * sizeof (KeySym));
}
total_length += sizeof(xStringFeedbackState) +
(s->ctrl.num_symbols_supported * sizeof(KeySym));
}
for (i=dev->intfeed; i; i=i->next)
{
rep.num_feedbacks++;
total_length += sizeof(xIntegerFeedbackState);
}
}
for (l=dev->leds; l; l=l->next)
{
rep.num_feedbacks++;
total_length += sizeof(xLedFeedbackState);
}
}
for (b=dev->bell; b; b=b->next)
{
rep.num_feedbacks++;
total_length += sizeof(xBellFeedbackState);
}
}
if (total_length == 0)
{
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
BadMatch);
return Success;
}
}
buf = (char *) malloc (total_length);
buf = (char *)malloc(total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
BadAlloc);
return Success;
}
savbuf=buf;
for (k=dev->kbdfeed; k; k=k->next)
CopySwapKbdFeedback (client, k, &buf);
for (p=dev->ptrfeed; p; p=p->next)
CopySwapPtrFeedback (client, p, &buf);
for (s=dev->stringfeed; s; s=s->next)
CopySwapStringFeedback (client, s, &buf);
for (i=dev->intfeed; i; i=i->next)
CopySwapIntegerFeedback (client, i, &buf);
for (l=dev->leds; l; l=l->next)
CopySwapLedFeedback (client, l, &buf);
for (b=dev->bell; b; b=b->next)
CopySwapBellFeedback (client, b, &buf);
rep.length = (total_length+3) >> 2;
}
savbuf = buf;
for (k = dev->kbdfeed; k; k = k->next)
CopySwapKbdFeedback(client, k, &buf);
for (p = dev->ptrfeed; p; p = p->next)
CopySwapPtrFeedback(client, p, &buf);
for (s = dev->stringfeed; s; s = s->next)
CopySwapStringFeedback(client, s, &buf);
for (i = dev->intfeed; i; i = i->next)
CopySwapIntegerFeedback(client, i, &buf);
for (l = dev->leds; l; l = l->next)
CopySwapLedFeedback(client, l, &buf);
for (b = dev->bell; b; b = b->next)
CopySwapBellFeedback(client, b, &buf);
rep.length = (total_length + 3) >> 2;
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
free (savbuf);
free(savbuf);
return Success;
}
}
/***********************************************************************
*
......@@ -199,13 +199,13 @@ CopySwapKbdFeedback (client, k, buf)
ClientPtr client;
KbdFeedbackPtr k;
char **buf;
{
int i;
xKbdFeedbackState *k2;
{
int i;
xKbdFeedbackState *k2;
k2 = (xKbdFeedbackState *) *buf;
k2 = (xKbdFeedbackState *) * buf;
k2->class = KbdFeedbackClass;
k2->length = sizeof (xKbdFeedbackState);
k2->length = sizeof(xKbdFeedbackState);
k2->id = k->ctrl.id;
k2->click = k->ctrl.click;
k2->percent = k->ctrl.bell;
......@@ -213,7 +213,7 @@ CopySwapKbdFeedback (client, k, buf)
k2->duration = k->ctrl.bell_duration;
k2->led_mask = k->ctrl.leds;
k2->global_auto_repeat = k->ctrl.autoRepeat;
for (i=0; i<32; i++)
for (i = 0; i < 32; i++)
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
if (client->swapped)
{
......@@ -222,9 +222,9 @@ CopySwapKbdFeedback (client, k, buf)
swaps(&k2->duration);
swapl(&k2->led_mask);
swapl(&k2->led_values);
}
*buf += sizeof (xKbdFeedbackState);
}
*buf += sizeof(xKbdFeedbackState);
}
/***********************************************************************
*
......@@ -237,12 +237,12 @@ CopySwapPtrFeedback (client, p, buf)
ClientPtr client;
PtrFeedbackPtr p;
char **buf;
{
xPtrFeedbackState *p2;
{
xPtrFeedbackState *p2;
p2 = (xPtrFeedbackState *) *buf;
p2 = (xPtrFeedbackState *) * buf;
p2->class = PtrFeedbackClass;
p2->length = sizeof (xPtrFeedbackState);
p2->length = sizeof(xPtrFeedbackState);
p2->id = p->ctrl.id;
p2->accelNum = p->ctrl.num;
p2->accelDenom = p->ctrl.den;
......@@ -253,9 +253,9 @@ CopySwapPtrFeedback (client, p, buf)
swaps(&p2->accelNum);
swaps(&p2->accelDenom);
swaps(&p2->threshold);
}
*buf += sizeof (xPtrFeedbackState);
}
*buf += sizeof(xPtrFeedbackState);
}
/***********************************************************************
*
......@@ -268,12 +268,12 @@ CopySwapIntegerFeedback (client, i, buf)
ClientPtr client;
IntegerFeedbackPtr i;
char **buf;
{
xIntegerFeedbackState *i2;
{
xIntegerFeedbackState *i2;
i2 = (xIntegerFeedbackState *) *buf;
i2 = (xIntegerFeedbackState *) * buf;
i2->class = IntegerFeedbackClass;
i2->length = sizeof (xIntegerFeedbackState);
i2->length = sizeof(xIntegerFeedbackState);
i2->id = i->ctrl.id;
i2->resolution = i->ctrl.resolution;
i2->min_value = i->ctrl.min_value;
......@@ -284,9 +284,9 @@ CopySwapIntegerFeedback (client, i, buf)
swapl(&i2->resolution);
swapl(&i2->min_value);
swapl(&i2->max_value);
}
*buf += sizeof (xIntegerFeedbackState);
}
*buf += sizeof(xIntegerFeedbackState);
}
/***********************************************************************
*
......@@ -299,35 +299,35 @@ CopySwapStringFeedback (client, s, buf)
ClientPtr client;
StringFeedbackPtr s;
char **buf;
{
{
int i;
xStringFeedbackState *s2;
KeySym *kptr;
xStringFeedbackState *s2;
KeySym *kptr;
s2 = (xStringFeedbackState *) *buf;
s2 = (xStringFeedbackState *) * buf;
s2->class = StringFeedbackClass;
s2->length = sizeof (xStringFeedbackState) +
s->ctrl.num_symbols_supported * sizeof (KeySym);
s2->length = sizeof(xStringFeedbackState) +
s->ctrl.num_symbols_supported * sizeof(KeySym);
s2->id = s->ctrl.id;
s2->max_symbols = s->ctrl.max_symbols;
s2->num_syms_supported = s->ctrl.num_symbols_supported;
*buf += sizeof (xStringFeedbackState);
*buf += sizeof(xStringFeedbackState);
kptr = (KeySym *) (*buf);
for (i=0; i<s->ctrl.num_symbols_supported; i++)
*kptr++ = *(s->ctrl.symbols_supported+i);
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
*kptr++ = *(s->ctrl.symbols_supported + i);
if (client->swapped)
{
swaps(&s2->length);
swaps(&s2->max_symbols);
swaps(&s2->num_syms_supported);
kptr = (KeySym *) (*buf);
kptr = (KeySym *) (*buf);
for (i=0; i<s->ctrl.num_symbols_supported; i++,kptr++)
{
swapl(kptr);
}
}
*buf += (s->ctrl.num_symbols_supported * sizeof (KeySym));
}
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
}
/***********************************************************************
*
......@@ -340,12 +340,12 @@ CopySwapLedFeedback (client, l, buf)
ClientPtr client;
LedFeedbackPtr l;
char **buf;
{
xLedFeedbackState *l2;
{
xLedFeedbackState *l2;
l2 = (xLedFeedbackState *) *buf;
l2 = (xLedFeedbackState *) * buf;
l2->class = LedFeedbackClass;
l2->length = sizeof (xLedFeedbackState);
l2->length = sizeof(xLedFeedbackState);
l2->id = l->ctrl.id;
l2->led_values = l->ctrl.led_values;
l2->led_mask = l->ctrl.led_mask;
......@@ -354,9 +354,9 @@ CopySwapLedFeedback (client, l, buf)
swaps(&l2->length);
swapl(&l2->led_values);
swapl(&l2->led_mask);
}
*buf += sizeof (xLedFeedbackState);
}
*buf += sizeof(xLedFeedbackState);
}
/***********************************************************************
*
......@@ -369,12 +369,12 @@ CopySwapBellFeedback (client, b, buf)
ClientPtr client;
BellFeedbackPtr b;
char **buf;
{
xBellFeedbackState *b2;
{
xBellFeedbackState *b2;
b2 = (xBellFeedbackState *) *buf;
b2 = (xBellFeedbackState *) * buf;
b2->class = BellFeedbackClass;
b2->length = sizeof (xBellFeedbackState);
b2->length = sizeof(xBellFeedbackState);
b2->id = b->ctrl.id;
b2->percent = b->ctrl.percent;
b2->pitch = b->ctrl.pitch;
......@@ -384,9 +384,9 @@ CopySwapBellFeedback (client, b, buf)
swaps(&b2->length);
swaps(&b2->pitch);
swaps(&b2->duration);
}
*buf += sizeof (xBellFeedbackState);
}
*buf += sizeof(xBellFeedbackState);
}
/***********************************************************************
*
......@@ -400,9 +400,9 @@ SRepXGetFeedbackControl (client, size, rep)
ClientPtr client;
int size;
xGetFeedbackControlReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_feedbacks);
WriteToClient(client, size, rep);
}
}
......@@ -33,60 +33,60 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetFeedbackControl(
ClientPtr /* client */
);
);
int
ProcXGetFeedbackControl(
ClientPtr /* client */
);
);
void
CopySwapKbdFeedback (
ClientPtr /* client */,
KbdFeedbackPtr /* k */,
char ** /* buf */
);
KbdFeedbackPtr /* k */ ,
char ** /* buf */
);
void
CopySwapPtrFeedback (
ClientPtr /* client */,
PtrFeedbackPtr /* p */,
char ** /* buf */
);
PtrFeedbackPtr /* p */ ,
char ** /* buf */
);
void
CopySwapIntegerFeedback (
ClientPtr /* client */,
IntegerFeedbackPtr /* i */,
char ** /* buf */
);
IntegerFeedbackPtr /* i */ ,
char ** /* buf */
);
void
CopySwapStringFeedback (
ClientPtr /* client */,
StringFeedbackPtr /* s */,
char ** /* buf */
);
StringFeedbackPtr /* s */ ,
char ** /* buf */
);
void
CopySwapLedFeedback (
ClientPtr /* client */,
LedFeedbackPtr /* l */,
char ** /* buf */
);
LedFeedbackPtr /* l */ ,
char ** /* buf */
);
void
CopySwapBellFeedback (
ClientPtr /* client */,
BellFeedbackPtr /* b */,
char ** /* buf */
);
BellFeedbackPtr /* b */ ,
char ** /* buf */
);
void
SRepXGetFeedbackControl (
ClientPtr /* client */,
int /* size */,
xGetFeedbackControlReply * /* rep */
);
int /* size */ ,
xGetFeedbackControlReply * /* rep */
);
#endif /* GETFCTL_H */
......@@ -76,11 +76,11 @@ SOFTWARE.
int
SProcXGetDeviceFocus(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length);
return(ProcXGetDeviceFocus(client));
}
return (ProcXGetDeviceFocus(client));
}
/***********************************************************************
*
......@@ -91,20 +91,20 @@ SProcXGetDeviceFocus(client)
int
ProcXGetDeviceFocus(client)
ClientPtr client;
{
DeviceIntPtr dev;
FocusClassPtr focus;
{
DeviceIntPtr dev;
FocusClassPtr focus;
xGetDeviceFocusReply rep;
REQUEST(xGetDeviceFocusReq);
REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL || !dev->focus)
{
SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus;
......@@ -119,14 +119,14 @@ ProcXGetDeviceFocus(client)
rep.focus = PointerRoot;
else if (focus->win == FollowKeyboardWin)
rep.focus = FollowKeyboard;
else
else
rep.focus = focus->win->drawable.id;
rep.time = focus->time.milliseconds;
rep.revertTo = focus->revert;
WriteReplyToClient (client, sizeof(xGetDeviceFocusReply), &rep);
WriteReplyToClient(client, sizeof(xGetDeviceFocusReply), &rep);
return Success;
}
}
/***********************************************************************
*
......@@ -140,10 +140,10 @@ SRepXGetDeviceFocus (client, size, rep)
ClientPtr client;
int size;
xGetDeviceFocusReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
swapl(&rep->time);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceFocus(
ClientPtr /* client */
);
);
int
ProcXGetDeviceFocus(
ClientPtr /* client */
);
);
void
SRepXGetDeviceFocus (
ClientPtr /* client */,
int /* size */,
xGetDeviceFocusReply * /* rep */
);
int /* size */ ,
xGetDeviceFocusReply * /* rep */
);
#endif /* GETFOCUS_H */
......@@ -77,11 +77,11 @@ SOFTWARE.
int
SProcXGetDeviceKeyMapping(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length);
return(ProcXGetDeviceKeyMapping(client));
}
return (ProcXGetDeviceKeyMapping(client));
}
/***********************************************************************
*
......@@ -92,29 +92,29 @@ SProcXGetDeviceKeyMapping(client)
int
ProcXGetDeviceKeyMapping(client)
register ClientPtr client;
{
{
xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev;
KeySymsPtr k;
KeySymsPtr k;
REQUEST(xGetDeviceKeyMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
BadDevice);
return Success;
}
}
if (dev->key == NULL)
{
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
BadMatch);
return Success;
}
k = &dev->key->curKeySyms;
}
k = &dev->key->curKeySyms;
if ((stuff->firstKeyCode < k->minKeyCode) ||
(stuff->firstKeyCode > k->maxKeyCode))
......@@ -123,7 +123,7 @@ ProcXGetDeviceKeyMapping(client)
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
BadValue);
return Success;
}
}
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1)
{
......@@ -131,24 +131,24 @@ ProcXGetDeviceKeyMapping(client)
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
BadValue);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_GetDeviceKeyMapping;
rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = k->mapWidth;
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(
client,
k->mapWidth * stuff->count * sizeof(KeySym),
&k->map[(stuff->firstKeyCode - k->minKeyCode) *
k->mapWidth]);
k->mapWidth * stuff->count * sizeof(KeySym),
&k->map[(stuff->firstKeyCode - k->minKeyCode) *
k->mapWidth]);
return Success;
}
}
/***********************************************************************
*
......@@ -162,9 +162,9 @@ SRepXGetDeviceKeyMapping (client, size, rep)
ClientPtr client;
int size;
xGetDeviceKeyMappingReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceKeyMapping(
ClientPtr /* client */
);
);
int
ProcXGetDeviceKeyMapping(
ClientPtr /* client */
);
);
void
SRepXGetDeviceKeyMapping (
ClientPtr /* client */,
int /* size */,
xGetDeviceKeyMappingReply * /* rep */
);
int /* size */ ,
xGetDeviceKeyMappingReply * /* rep */
);
#endif /* GETKMAP_H */
......@@ -76,11 +76,11 @@ SOFTWARE.
int
SProcXGetDeviceModifierMapping(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length);
return(ProcXGetDeviceModifierMapping(client));
}
return (ProcXGetDeviceModifierMapping(client));
}
/***********************************************************************
*
......@@ -91,45 +91,45 @@ SProcXGetDeviceModifierMapping(client)
int
ProcXGetDeviceModifierMapping(client)
ClientPtr client;
{
CARD8 maxkeys;
DeviceIntPtr dev;
xGetDeviceModifierMappingReply rep;
KeyClassPtr kp;
{
CARD8 maxkeys;
DeviceIntPtr dev;
xGetDeviceModifierMappingReply rep;
KeyClassPtr kp;
REQUEST(xGetDeviceModifierMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
BadDevice);
return Success;
}
}
kp = dev->key;
if (kp == NULL)
{
SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
BadMatch);
return Success;
}
maxkeys = kp->maxKeysPerModifier;
}
maxkeys = kp->maxKeysPerModifier;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceModifierMapping;
rep.numKeyPerModifier = maxkeys;
rep.sequenceNumber = client->sequence;
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
rep.length = 2*maxkeys;
rep.length = 2 * maxkeys;
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
/* Reply with the (modified by DDX) map that SetModifierMapping passed in */
WriteToClient(client, 8*maxkeys, kp->modifierKeyMap);
WriteToClient(client, 8 * maxkeys, kp->modifierKeyMap);
return Success;
}
}
/***********************************************************************
*
......@@ -143,8 +143,8 @@ SRepXGetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;
xGetDeviceModifierMappingReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceModifierMapping(
ClientPtr /* client */
);
);
int
ProcXGetDeviceModifierMapping(
ClientPtr /* client */
);
);
void
SRepXGetDeviceModifierMapping (
ClientPtr /* client */,
int /* size */,
xGetDeviceModifierMappingReply * /* rep */
);
int /* size */ ,
xGetDeviceModifierMappingReply * /* rep */
);
#endif /* GETMMAP_H */
......@@ -68,8 +68,8 @@ SOFTWARE.
#include "getprop.h"
extern XExtEventInfo EventInfo[];
extern int ExtEventIndex;
extern XExtEventInfo EventInfo[];
extern int ExtEventIndex;
/***********************************************************************
*
......@@ -80,13 +80,13 @@ extern int ExtEventIndex;
int
SProcXGetDeviceDontPropagateList(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
return(ProcXGetDeviceDontPropagateList(client));
}
return (ProcXGetDeviceDontPropagateList(client));
}
/***********************************************************************
*
......@@ -97,13 +97,13 @@ SProcXGetDeviceDontPropagateList(client)
int
ProcXGetDeviceDontPropagateList (client)
register ClientPtr client;
{
CARD16 count = 0;
int i;
XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
OtherInputMasks *others;
{
CARD16 count = 0;
int i;
XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
......@@ -114,44 +114,44 @@ ProcXGetDeviceDontPropagateList (client)
rep.length = 0;
rep.count = 0;
pWin = (WindowPtr) LookupWindow (stuff->window, client);
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin)
{
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
BadWindow);
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
BadWindow);
return Success;
}
}
if ((others = wOtherInputMasks(pWin)) != 0)
{
for (i=0; i<EMASKSIZE; i++)
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
&count, COUNT);
for (i = 0; i < EMASKSIZE; i++)
tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i,
&count, COUNT);
if (count)
{
rep.count = count;
buf = (XEventClass *) malloc (rep.count * sizeof(XEventClass));
rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
rep.length = (rep.count * sizeof(XEventClass) + 3) >> 2;
tbuf = buf;
for (i=0; i<EMASKSIZE; i++)
tbuf = ClassFromMask (tbuf, others->dontPropagateMask[i], i,
NULL, CREATE);
}
for (i = 0; i < EMASKSIZE; i++)
tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
NULL, CREATE);
}
}
WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply),
&rep);
if (count)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
free (buf);
}
return Success;
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
free(buf);
}
return Success;
}
/***********************************************************************
*
......@@ -167,25 +167,25 @@ XEventClass
int maskndx;
CARD16 *count;
int mode;
{
int i,j;
int id = maskndx;
Mask tmask = 0x80000000;
{
int i, j;
int id = maskndx;
Mask tmask = 0x80000000;
for (i=0; i<32; i++,tmask>>=1)
for (i = 0; i < 32; i++, tmask >>= 1)
if (tmask & mask)
{
for (j=0; j<ExtEventIndex; j++)
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].mask == tmask)
{
if (mode == COUNT)
(*count)++;
else
*buf++ = (id << 8) | EventInfo[j].type;
}
}
*buf++ = (id << 8) | EventInfo[j].type;
}
}
return (buf);
}
}
/***********************************************************************
*
......@@ -199,9 +199,9 @@ SRepXGetDeviceDontPropagateList (client, size, rep)
ClientPtr client;
int size;
xGetDeviceDontPropagateListReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->count);
WriteToClient(client, size, rep);
}
}
......@@ -33,27 +33,27 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceDontPropagateList(
ClientPtr /* client */
);
);
int
ProcXGetDeviceDontPropagateList (
ClientPtr /* client */
);
);
XEventClass *
ClassFromMask (
XEventClass * /* buf */,
Mask /* mask */,
int /* maskndx */,
CARD16 * /* count */,
int /* mode */
);
Mask /* mask */ ,
int /* maskndx */ ,
CARD16 * /* count */ ,
int /* mode */
);
void
SRepXGetDeviceDontPropagateList (
ClientPtr /* client */,
int /* size */,
xGetDeviceDontPropagateListReply * /* rep */
);
int /* size */ ,
xGetDeviceDontPropagateListReply * /* rep */
);
#endif /* GETPROP_H */
......@@ -78,13 +78,13 @@ SOFTWARE.
int
SProcXGetSelectedExtensionEvents(client)
register ClientPtr client;
{
{
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return(ProcXGetSelectedExtensionEvents(client));
}
return (ProcXGetSelectedExtensionEvents(client));
}
/***********************************************************************
*
......@@ -96,16 +96,16 @@ SProcXGetSelectedExtensionEvents(client)
int
ProcXGetSelectedExtensionEvents(client)
register ClientPtr client;
{
int i;
int total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
XEventClass *buf = NULL;
XEventClass *tclient;
XEventClass *aclient;
OtherInputMasks *pOthers;
InputClientsPtr others;
{
int i;
int total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
XEventClass *buf = NULL;
XEventClass *tclient;
XEventClass *aclient;
OtherInputMasks *pOthers;
InputClientsPtr others;
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
......@@ -119,53 +119,53 @@ ProcXGetSelectedExtensionEvents(client)
if (!(pWin = LookupWindow(stuff->window, client)))
{
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
BadWindow);
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
BadWindow);
return Success;
}
}
if ((pOthers = wOtherInputMasks(pWin)) != 0)
{
for (others = pOthers->inputClients; others; others=others->next)
for (i=0; i<EMASKSIZE; i++)
tclient = ClassFromMask (NULL, others->mask[i], i,
&rep.all_clients_count, COUNT);
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
tclient = ClassFromMask(NULL, others->mask[i], i,
&rep.all_clients_count, COUNT);
for (others = pOthers->inputClients; others; others=others->next)
for (others = pOthers->inputClients; others; others = others->next)
if (SameClient(others, client))
{
for (i=0; i<EMASKSIZE; i++)
tclient = ClassFromMask (NULL, others->mask[i], i,
&rep.this_client_count, COUNT);
for (i = 0; i < EMASKSIZE; i++)
tclient = ClassFromMask(NULL, others->mask[i], i,
&rep.this_client_count, COUNT);
break;
}
}
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof (XEventClass);
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof(XEventClass);
rep.length = (total_length + 3) >> 2;
buf = (XEventClass *) malloc (total_length);
buf = (XEventClass *) malloc(total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
if (others)
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
tclient = ClassFromMask (tclient, others->mask[i], i, NULL, CREATE);
for (others = pOthers->inputClients; others; others=others->next)
for (i=0; i<EMASKSIZE; i++)
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
aclient = ClassFromMask (aclient, others->mask[i], i, NULL, CREATE);
}
}
WriteReplyToClient (client, sizeof(xGetSelectedExtensionEventsReply), &rep);
WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep);
if (total_length)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient( client, total_length, buf);
free (buf);
}
return Success;
WriteSwappedDataToClient(client, total_length, buf);
free(buf);
}
return Success;
}
/***********************************************************************
*
......@@ -179,10 +179,10 @@ SRepXGetSelectedExtensionEvents (client, size, rep)
ClientPtr client;
int size;
xGetSelectedExtensionEventsReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->this_client_count);
swaps(&rep->all_clients_count);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetSelectedExtensionEvents(
ClientPtr /* client */
);
);
int
ProcXGetSelectedExtensionEvents(
ClientPtr /* client */
);
);
void
SRepXGetSelectedExtensionEvents (
ClientPtr /* client */,
int /* size */,
xGetSelectedExtensionEventsReply * /* rep */
);
int /* size */ ,
xGetSelectedExtensionEventsReply * /* rep */
);
#endif /* GETSELEV_H */
......@@ -66,7 +66,7 @@ SOFTWARE.
#include "getvers.h"
XExtensionVersion AllExtensionVersions[128];
XExtensionVersion AllExtensionVersions[128];
/***********************************************************************
*
......@@ -77,13 +77,13 @@ XExtensionVersion AllExtensionVersions[128];
int
SProcXGetExtensionVersion(client)
register ClientPtr client;
{
{
REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes);
return(ProcXGetExtensionVersion(client));
}
return (ProcXGetExtensionVersion(client));
}
/***********************************************************************
*
......@@ -94,19 +94,19 @@ SProcXGetExtensionVersion(client)
int
ProcXGetExtensionVersion (client)
register ClientPtr client;
{
xGetExtensionVersionReply rep;
{
xGetExtensionVersionReply rep;
REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (stuff->length != (sizeof(xGetExtensionVersionReq) +
if (stuff->length != (sizeof(xGetExtensionVersionReq) +
stuff->nbytes + 3)>>2)
{
SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
BadLength);
SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
BadLength);
return Success;
}
}
memset(&rep, 0, sizeof(xGetExtensionVersionReply));
rep.repType = X_Reply;
......@@ -123,11 +123,11 @@ ProcXGetExtensionVersion (client)
AllExtensionVersions[IReqCode-128].major_version;
rep.minor_version =
AllExtensionVersions[IReqCode-128].minor_version;
}
WriteReplyToClient (client, sizeof (xGetExtensionVersionReply), &rep);
}
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
return Success;
}
}
/***********************************************************************
*
......@@ -141,10 +141,10 @@ SRepXGetExtensionVersion (client, size, rep)
ClientPtr client;
int size;
xGetExtensionVersionReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetExtensionVersion(
ClientPtr /* client */
);
);
int
ProcXGetExtensionVersion (
ClientPtr /* client */
);
);
void
SRepXGetExtensionVersion (
ClientPtr /* client */,
int /* size */,
xGetExtensionVersionReply * /* rep */
);
int /* size */ ,
xGetExtensionVersionReply * /* rep */
);
#endif /* GETVERS_H */
......@@ -69,8 +69,8 @@ SOFTWARE.
#include "grabdev.h"
extern XExtEventInfo EventInfo[];
extern int ExtEventIndex;
extern XExtEventInfo EventInfo[];
extern int ExtEventIndex;
/***********************************************************************
*
......@@ -81,7 +81,7 @@ extern int ExtEventIndex;
int
SProcXGrabDevice(client)
register ClientPtr client;
{
{
REQUEST(xGrabDeviceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
......@@ -90,12 +90,12 @@ SProcXGrabDevice(client)
swaps(&stuff->event_count);
if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
return BadLength;
return BadLength;
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDevice(client));
}
return (ProcXGrabDevice(client));
}
/***********************************************************************
*
......@@ -106,38 +106,38 @@ SProcXGrabDevice(client)
int
ProcXGrabDevice(client)
ClientPtr client;
{
int error;
xGrabDeviceReply rep;
DeviceIntPtr dev;
struct tmask tmp[EMASKSIZE];
{
int error;
xGrabDeviceReply rep;
DeviceIntPtr dev;
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (stuff->length !=(sizeof(xGrabDeviceReq)>>2) + stuff->event_count)
{
SendErrorToClient (client, IReqCode, X_GrabDevice, 0, BadLength);
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadLength);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_GrabDevice;
rep.sequenceNumber = client->sequence;
rep.length = 0;
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
return Success;
}
}
if (CreateMaskFromList (client, (XEventClass *)&stuff[1],
if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->event_count, tmp, dev, X_GrabDevice) != Success)
return Success;
error = GrabDevice (client, dev, stuff->this_device_mode,
error = GrabDevice(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->grabWindow, stuff->ownerEvents,
stuff->time, tmp[stuff->deviceid].mask, &rep.status);
......@@ -145,10 +145,10 @@ ProcXGrabDevice(client)
{
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
return Success;
}
}
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
}
}
/***********************************************************************
......@@ -165,16 +165,16 @@ CreateMaskFromList (client, list, count, mask, dev, req)
struct tmask mask[];
DeviceIntPtr dev;
int req;
{
int i,j;
int device;
DeviceIntPtr tdev;
{
int i, j;
int device;
DeviceIntPtr tdev;
for (i=0; i<EMASKSIZE; i++)
{
mask[i].mask = 0;
mask[i].dev = NULL;
}
}
for (i=0; i<count; i++, list++)
{
......@@ -183,24 +183,24 @@ CreateMaskFromList (client, list, count, mask, dev, req)
{
SendErrorToClient(client, IReqCode, req, 0, BadClass);
return BadClass;
}
tdev = LookupDeviceIntRec (device);
}
tdev = LookupDeviceIntRec(device);
if (tdev==NULL || (dev != NULL && tdev != dev))
{
SendErrorToClient(client, IReqCode, req, 0, BadClass);
return BadClass;
}
}
for (j=0; j<ExtEventIndex; j++)
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff))
{
mask[device].mask |= EventInfo[j].mask;
mask[device].dev = (Pointer) tdev;
break;
}
}
return Success;
}
}
return Success;
}
/***********************************************************************
*
......@@ -214,8 +214,8 @@ SRepXGrabDevice (client, size, rep)
ClientPtr client;
int size;
xGrabDeviceReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,28 +33,28 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGrabDevice(
ClientPtr /* client */
);
);
int
ProcXGrabDevice(
ClientPtr /* client */
);
);
int
CreateMaskFromList (
ClientPtr /* client */,
XEventClass * /* list */,
int /* count */,
struct tmask /* mask */[],
DeviceIntPtr /* dev */,
int /* req */
);
XEventClass * /* list */ ,
int /* count */ ,
struct tmask /* mask */ [],
DeviceIntPtr /* dev */ ,
int /* req */
);
void
SRepXGrabDevice (
ClientPtr /* client */,
int /* size */,
xGrabDeviceReply * /* rep */
);
int /* size */ ,
xGrabDeviceReply * /* rep */
);
#endif /* GRABDEV_H */
......@@ -78,7 +78,7 @@ SOFTWARE.
int
SProcXGrabDeviceButton(client)
register ClientPtr client;
{
{
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
......@@ -86,11 +86,11 @@ SProcXGrabDeviceButton(client)
swaps(&stuff->modifiers);
swaps(&stuff->event_count);
REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
stuff->event_count * sizeof(CARD32));
stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDeviceButton(client));
}
return (ProcXGrabDeviceButton(client));
}
/***********************************************************************
*
......@@ -101,59 +101,59 @@ SProcXGrabDeviceButton(client)
int
ProcXGrabDeviceButton(client)
ClientPtr client;
{
int ret;
DeviceIntPtr dev;
DeviceIntPtr mdev;
XEventClass *class;
struct tmask tmp[EMASKSIZE];
{
int ret;
DeviceIntPtr dev;
DeviceIntPtr mdev;
XEventClass *class;
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceButtonReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=(sizeof(xGrabDeviceButtonReq)>>2) + stuff->event_count)
{
SendErrorToClient (client, IReqCode, X_GrabDeviceButton, 0, BadLength);
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength);
return Success;
}
}
dev = LookupDeviceIntRec (stuff->grabbed_device);
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadDevice);
return Success;
}
}
if (stuff->modifier_device != UseXKeyboard)
{
mdev = LookupDeviceIntRec (stuff->modifier_device);
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadDevice);
return Success;
}
}
if (mdev->key == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadMatch);
return Success;
}
}
}
else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
class = (XEventClass *) (&stuff[1]); /* first word of values */
if ((ret = CreateMaskFromList (client, class,
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev, X_GrabDeviceButton)) != Success)
return Success;
ret = GrabButton(client, dev, stuff->this_device_mode,
return Success;
ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button,
stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0,
tmp[stuff->grabbed_device].mask);
if (ret != Success)
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
return(Success);
}
return (Success);
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGrabDeviceButton(
ClientPtr /* client */
);
);
int
ProcXGrabDeviceButton(
ClientPtr /* client */
);
);
#endif /* GRABDEVB_H */
......@@ -78,7 +78,7 @@ SOFTWARE.
int
SProcXGrabDeviceKey(client)
register ClientPtr client;
{
{
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
......@@ -87,8 +87,8 @@ SProcXGrabDeviceKey(client)
swaps(&stuff->event_count);
REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDeviceKey(client));
}
return (ProcXGrabDeviceKey(client));
}
/***********************************************************************
*
......@@ -99,64 +99,64 @@ SProcXGrabDeviceKey(client)
int
ProcXGrabDeviceKey(client)
ClientPtr client;
{
int ret;
DeviceIntPtr dev;
DeviceIntPtr mdev;
XEventClass *class;
struct tmask tmp[EMASKSIZE];
{
int ret;
DeviceIntPtr dev;
DeviceIntPtr mdev;
XEventClass *class;
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (stuff->length !=(sizeof(xGrabDeviceKeyReq)>>2) + stuff->event_count)
{
SendErrorToClient (client, IReqCode, X_GrabDeviceKey, 0, BadLength);
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadLength);
return Success;
}
}
dev = LookupDeviceIntRec (stuff->grabbed_device);
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
BadDevice);
return Success;
}
}
if (stuff->modifier_device != UseXKeyboard)
{
mdev = LookupDeviceIntRec (stuff->modifier_device);
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
BadDevice);
return Success;
}
}
if (mdev->key == NULL)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
BadMatch);
return Success;
}
}
}
else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
class = (XEventClass *) (&stuff[1]); /* first word of values */
if ((ret = CreateMaskFromList (client, class,
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev, X_GrabDeviceKey)) != Success)
return Success;
return Success;
ret = GrabKey(client, dev, stuff->this_device_mode,
ret = GrabKey(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->key,
stuff->grabWindow, stuff->ownerEvents, tmp[stuff->grabbed_device].mask);
if (ret != Success)
{
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
return Success;
}
return Success;
}
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGrabDeviceKey(
ClientPtr /* client */
);
);
int
ProcXGrabDeviceKey(
ClientPtr /* client */
);
);
#endif /* GRABDEVK_H */
......@@ -76,14 +76,14 @@ SOFTWARE.
int
SProcXGetDeviceMotionEvents(client)
register ClientPtr client;
{
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);
return(ProcXGetDeviceMotionEvents(client));
}
return (ProcXGetDeviceMotionEvents(client));
}
/****************************************************************************
*
......@@ -98,30 +98,30 @@ ProcXGetDeviceMotionEvents(client)
INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep;
unsigned long i;
int num_events, axes, size = 0, tsize;
int num_events, axes, size = 0, tsize;
unsigned long nEvents;
DeviceIntPtr dev;
TimeStamp start, stop;
int length = 0;
ValuatorClassPtr v;
int length = 0;
ValuatorClassPtr v;
REQUEST(xGetDeviceMotionEventsReq);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadDevice);
return Success;
}
}
v = dev->valuator;
if (v==NULL || v->numAxes == 0)
{
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadMatch);
return Success;
}
}
if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client);
axes = v->numAxes;
......@@ -137,32 +137,32 @@ ProcXGetDeviceMotionEvents(client)
if (CompareTimeStamps(start, stop) == LATER ||
CompareTimeStamps(start, currentTime) == LATER)
{
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
return Success;
}
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
return Success;
}
if (CompareTimeStamps(stop, currentTime) == LATER)
stop = currentTime;
stop = currentTime;
num_events = v->numMotionEvents;
if (num_events)
{
size = sizeof(Time) + (axes * sizeof (INT32));
size = sizeof(Time) + (axes * sizeof(INT32));
tsize = num_events * size;
coords = (INT32 *) malloc(tsize);
if (!coords)
{
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadAlloc);
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadAlloc);
return Success;
}
}
rep.nEvents = (v->GetMotionProc) (
dev, (xTimecoord *)coords, /* XXX */
start.milliseconds, stop.milliseconds, (ScreenPtr)NULL);
}
if (rep.nEvents > 0)
{
length = (rep.nEvents * size +3) >> 2;
rep.length = length;
}
length = (rep.nEvents * size + 3) >> 2;
rep.length = length;
}
nEvents = rep.nEvents;
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
if (nEvents)
......@@ -174,10 +174,10 @@ ProcXGetDeviceMotionEvents(client)
{
swapl(bufptr);
bufptr++;
}
}
}
WriteToClient(client, length * 4, coords);
}
}
if (coords)
free(coords);
return Success;
......@@ -195,9 +195,9 @@ SRepXGetDeviceMotionEvents (client, size, rep)
ClientPtr client;
int size;
xGetDeviceMotionEventsReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->nEvents);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXGetDeviceMotionEvents(
ClientPtr /* client */
);
);
int
ProcXGetDeviceMotionEvents(
ClientPtr /* client */
);
);
void
SRepXGetDeviceMotionEvents (
ClientPtr /* client */,
int /* size */,
xGetDeviceMotionEventsReply * /* rep */
);
int /* size */ ,
xGetDeviceMotionEventsReply * /* rep */
);
#endif /* GTMOTION_H */
......@@ -67,7 +67,7 @@ SOFTWARE.
#include "listdev.h"
#define VPC 20 /* Max # valuators per chunk */
#define VPC 20 /* Max # valuators per chunk */
/***********************************************************************
*
......@@ -78,11 +78,11 @@ SOFTWARE.
int
SProcXListInputDevices(client)
register ClientPtr client;
{
{
REQUEST(xListInputDevicesReq);
swaps(&stuff->length);
return(ProcXListInputDevices(client));
}
return (ProcXListInputDevices(client));
}
/***********************************************************************
*
......@@ -93,18 +93,18 @@ SProcXListInputDevices(client)
int
ProcXListInputDevices (client)
register ClientPtr client;
{
xListInputDevicesReply rep;
int numdevs;
int namesize = 1; /* need 1 extra byte for strcpy */
int size = 0;
int total_length;
char *devbuf;
char *classbuf;
char *namebuf;
char *savbuf;
xDeviceInfo *dev;
DeviceIntPtr d;
{
xListInputDevicesReply rep;
int numdevs;
int namesize = 1; /* need 1 extra byte for strcpy */
int size = 0;
int total_length;
char *devbuf;
char *classbuf;
char *namebuf;
char *savbuf;
xDeviceInfo *dev;
DeviceIntPtr d;
REQUEST_SIZE_MATCH(xListInputDevicesReq);
......@@ -114,33 +114,33 @@ ProcXListInputDevices (client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
AddOtherInputDevices ();
AddOtherInputDevices();
numdevs = inputInfo.numDevices;
for (d=inputInfo.devices; d; d=d->next)
SizeDeviceInfo (d, &namesize, &size);
for (d=inputInfo.off_devices; d; d=d->next)
SizeDeviceInfo (d, &namesize, &size);
for (d = inputInfo.devices; d; d = d->next)
SizeDeviceInfo(d, &namesize, &size);
for (d = inputInfo.off_devices; d; d = d->next)
SizeDeviceInfo(d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
devbuf = (char *) calloc (1, total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *)calloc(1, total_length);
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
dev = (xDeviceInfoPtr) devbuf;
for (d=inputInfo.devices; d; d=d->next,dev++)
ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf);
for (d=inputInfo.off_devices; d; d=d->next,dev++)
ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf);
for (d = inputInfo.devices; d; d = d->next, dev++)
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
for (d = inputInfo.off_devices; d; d = d->next, dev++)
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
rep.ndevices = numdevs;
rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf);
free (savbuf);
free(savbuf);
return Success;
}
}
/***********************************************************************
*
......@@ -154,23 +154,23 @@ SizeDeviceInfo (d, namesize, size)
DeviceIntPtr d;
int *namesize;
int *size;
{
{
int chunks;
*namesize += 1;
if (d->name)
*namesize += strlen (d->name);
*namesize += strlen(d->name);
if (d->key != NULL)
*size += sizeof (xKeyInfo);
*size += sizeof(xKeyInfo);
if (d->button != NULL)
*size += sizeof (xButtonInfo);
*size += sizeof(xButtonInfo);
if (d->valuator != NULL)
{
chunks = ((int) d->valuator->numAxes + 19) / VPC;
*size += (chunks * sizeof(xValuatorInfo) +
d->valuator->numAxes * sizeof(xAxisInfo));
}
chunks = ((int)d->valuator->numAxes + 19) / VPC;
*size += (chunks * sizeof(xValuatorInfo) +
d->valuator->numAxes * sizeof(xAxisInfo));
}
}
/***********************************************************************
*
......@@ -186,24 +186,24 @@ ListDeviceInfo (client, d, dev, devbuf, classbuf, namebuf)
char **devbuf;
char **classbuf;
char **namebuf;
{
CopyDeviceName (namebuf, d->name);
CopySwapDevice (client, d, 0, devbuf);
{
CopyDeviceName(namebuf, d->name);
CopySwapDevice(client, d, 0, devbuf);
if (d->key != NULL)
{
CopySwapKeyClass(client, d->key, classbuf);
dev->num_classes++;
}
}
if (d->button != NULL)
{
CopySwapButtonClass(client, d->button, classbuf);
dev->num_classes++;
}
}
if (d->valuator != NULL)
{
dev->num_classes += CopySwapValuatorClass(client, d->valuator, classbuf);
}
}
}
/***********************************************************************
*
......@@ -219,21 +219,21 @@ void
CopyDeviceName (namebuf, name)
char **namebuf;
char *name;
{
char *nameptr = (char *) *namebuf;
{
char *nameptr = (char *)*namebuf;
if (name)
{
*nameptr++ = strlen (name);
strcpy (nameptr, name);
*namebuf += (strlen (name)+1);
*nameptr++ = strlen(name);
strcpy(nameptr, name);
*namebuf += (strlen(name) + 1);
}
else
{
*nameptr++ = 0;
*namebuf += 1;
}
}
}
/***********************************************************************
*
......@@ -247,10 +247,10 @@ CopySwapDevice (client, d, num_classes, buf)
DeviceIntPtr d;
int num_classes;
char **buf;
{
{
xDeviceInfoPtr dev;
dev = (xDeviceInfoPtr) *buf;
dev = (xDeviceInfoPtr) * buf;
dev->id = d->id;
dev->type = d->type;
......@@ -264,9 +264,9 @@ CopySwapDevice (client, d, num_classes, buf)
if (client->swapped)
{
swapl(&dev->type); /* macro - braces are required */
}
*buf += sizeof (xDeviceInfo);
}
*buf += sizeof(xDeviceInfo);
}
/***********************************************************************
*
......@@ -279,21 +279,21 @@ CopySwapKeyClass (client, k, buf)
register ClientPtr client;
KeyClassPtr k;
char **buf;
{
xKeyInfoPtr k2;
{
xKeyInfoPtr k2;
k2 = (xKeyInfoPtr) *buf;
k2 = (xKeyInfoPtr) * buf;
k2->class = KeyClass;
k2->length = sizeof (xKeyInfo);
k2->length = sizeof(xKeyInfo);
k2->min_keycode = k->curKeySyms.minKeyCode;
k2->max_keycode = k->curKeySyms.maxKeyCode;
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
if (client->swapped)
{
swaps(&k2->num_keys);
}
*buf += sizeof (xKeyInfo);
}
*buf += sizeof(xKeyInfo);
}
/***********************************************************************
*
......@@ -306,19 +306,19 @@ CopySwapButtonClass (client, b, buf)
register ClientPtr client;
ButtonClassPtr b;
char **buf;
{
xButtonInfoPtr b2;
{
xButtonInfoPtr b2;
b2 = (xButtonInfoPtr) *buf;
b2 = (xButtonInfoPtr) * buf;
b2->class = ButtonClass;
b2->length = sizeof (xButtonInfo);
b2->length = sizeof(xButtonInfo);
b2->num_buttons = b->numButtons;
if (client->swapped)
{
swaps(&b2->num_buttons); /* macro - braces are required */
}
*buf += sizeof (xButtonInfo);
}
*buf += sizeof(xButtonInfo);
}
/***********************************************************************
*
......@@ -338,29 +338,29 @@ CopySwapValuatorClass (client, v, buf)
ValuatorClassPtr v;
char **buf;
{
int i, j, axes, t_axes;
xValuatorInfoPtr v2;
AxisInfo *a;
xAxisInfoPtr a2;
int i, j, axes, t_axes;
xValuatorInfoPtr v2;
AxisInfo *a;
xAxisInfoPtr a2;
for (i=0,axes=v->numAxes; i < ((v->numAxes+19)/VPC); i++, axes-=VPC) {
t_axes = axes < VPC ? axes : VPC;
if (t_axes < 0)
t_axes = v->numAxes % VPC;
v2 = (xValuatorInfoPtr) *buf;
v2 = (xValuatorInfoPtr) * buf;
v2->class = ValuatorClass;
v2->length = sizeof (xValuatorInfo) + t_axes * sizeof (xAxisInfo);
v2->num_axes = t_axes;
v2->mode = v->mode & DeviceMode;
v2->motion_buffer_size = v->numMotionEvents;
v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
v2->num_axes = t_axes;
v2->mode = v->mode & DeviceMode;
v2->motion_buffer_size = v->numMotionEvents;
if (client->swapped)
{
swapl(&v2->motion_buffer_size);
}
*buf += sizeof (xValuatorInfo);
}
*buf += sizeof(xValuatorInfo);
a = v->axes + (VPC * i);
a2 = (xAxisInfoPtr) *buf;
for (j=0; j<t_axes; j++) {
a2 = (xAxisInfoPtr) * buf;
for (j = 0; j < t_axes; j++) {
a2->min_value = a->min_value;
a2->max_value = a->max_value;
a2->resolution = a->resolution;
......@@ -371,7 +371,7 @@ CopySwapValuatorClass (client, v, buf)
}
a2++;
a++;
*buf += sizeof (xAxisInfo);
*buf += sizeof(xAxisInfo);
}
}
return (i);
......@@ -389,8 +389,8 @@ SRepXListInputDevices (client, size, rep)
ClientPtr client;
int size;
xListInputDevicesReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,70 +33,70 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXListInputDevices(
ClientPtr /* client */
);
);
int
ProcXListInputDevices (
ClientPtr /* client */
);
);
void
SizeDeviceInfo (
DeviceIntPtr /* d */,
int * /* namesize */,
int * /* size */
);
int * /* namesize */ ,
int * /* size */
);
void
ListDeviceInfo (
ClientPtr /* client */,
DeviceIntPtr /* d */,
xDeviceInfoPtr /* dev */,
char ** /* devbuf */,
char ** /* classbuf */,
char ** /* namebuf */
);
DeviceIntPtr /* d */ ,
xDeviceInfoPtr /* dev */ ,
char ** /* devbuf */ ,
char ** /* classbuf */ ,
char ** /* namebuf */
);
void
CopyDeviceName (
char ** /* namebuf */,
char * /* name */
);
char * /* name */
);
void
CopySwapDevice (
ClientPtr /* client */,
DeviceIntPtr /* d */,
int /* num_classes */,
char ** /* buf */
);
DeviceIntPtr /* d */ ,
int /* num_classes */ ,
char ** /* buf */
);
void
CopySwapKeyClass (
ClientPtr /* client */,
KeyClassPtr /* k */,
char ** /* buf */
);
KeyClassPtr /* k */ ,
char ** /* buf */
);
void
CopySwapButtonClass (
ClientPtr /* client */,
ButtonClassPtr /* b */,
char ** /* buf */
);
ButtonClassPtr /* b */ ,
char ** /* buf */
);
int
CopySwapValuatorClass (
ClientPtr /* client */,
ValuatorClassPtr /* v */,
char ** /* buf */
);
ValuatorClassPtr /* v */ ,
char ** /* buf */
);
void
SRepXListInputDevices (
ClientPtr /* client */,
int /* size */,
xListInputDevicesReply * /* rep */
);
int /* size */ ,
xListInputDevicesReply * /* rep */
);
#endif /* LISTDEV_H */
......@@ -68,7 +68,7 @@ SOFTWARE.
#include "opendev.h"
extern CARD8 event_base [];
extern CARD8 event_base[];
/***********************************************************************
*
......@@ -80,11 +80,11 @@ extern CARD8 event_base [];
int
SProcXOpenDevice(client)
register ClientPtr client;
{
{
REQUEST(xOpenDeviceReq);
swaps(&stuff->length);
return(ProcXOpenDevice(client));
}
return (ProcXOpenDevice(client));
}
/***********************************************************************
*
......@@ -95,43 +95,43 @@ SProcXOpenDevice(client)
int
ProcXOpenDevice(client)
register ClientPtr client;
{
xInputClassInfo evbase [numInputClasses];
{
xInputClassInfo evbase[numInputClasses];
Bool enableit = FALSE;
int j=0;
int j = 0;
int status = Success;
xOpenDeviceReply rep;
xOpenDeviceReply rep;
DeviceIntPtr dev;
REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq);
if (stuff->deviceid == inputInfo.pointer->id ||
if (stuff->deviceid == inputInfo.pointer->id ||
stuff->deviceid == inputInfo.keyboard->id)
{
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success;
}
return Success;
}
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) /* not open */
{
for (dev=inputInfo.off_devices; dev; dev=dev->next)
for (dev = inputInfo.off_devices; dev; dev = dev->next)
if (dev->id == stuff->deviceid)
break;
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success;
}
enableit = TRUE;
}
enableit = TRUE;
}
OpenInputDevice (dev, client, &status);
OpenInputDevice(dev, client, &status);
if (status != Success)
{
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
return Success;
}
}
if (enableit && dev->inited && dev->startup)
(void)EnableDevice(dev);
......@@ -143,41 +143,41 @@ ProcXOpenDevice(client)
{
evbase[j].class = KeyClass;
evbase[j++].event_type_base = event_base[KeyClass];
}
}
if (dev->button != NULL)
{
evbase[j].class = ButtonClass;
evbase[j++].event_type_base = event_base[ButtonClass];
}
}
if (dev->valuator != NULL)
{
evbase[j].class = ValuatorClass;
evbase[j++].event_type_base = event_base[ValuatorClass];
}
}
if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL)
{
evbase[j].class = FeedbackClass;
evbase[j++].event_type_base = event_base[FeedbackClass];
}
}
if (dev->focus != NULL)
{
evbase[j].class = FocusClass;
evbase[j++].event_type_base = event_base[FocusClass];
}
}
if (dev->proximity != NULL)
{
evbase[j].class = ProximityClass;
evbase[j++].event_type_base = event_base[ProximityClass];
}
}
evbase[j].class = OtherClass;
evbase[j++].event_type_base = event_base[OtherClass];
rep.length = (j * sizeof (xInputClassInfo) + 3) >> 2;
rep.length = (j * sizeof(xInputClassInfo) + 3) >> 2;
rep.num_classes = j;
WriteReplyToClient (client, sizeof (xOpenDeviceReply), &rep);
WriteToClient(client, j * sizeof (xInputClassInfo), evbase);
WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
return (Success);
}
}
/***********************************************************************
*
......@@ -191,8 +191,8 @@ SRepXOpenDevice (client, size, rep)
ClientPtr client;
int size;
xOpenDeviceReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXOpenDevice(
ClientPtr /* client */
);
);
int
ProcXOpenDevice(
ClientPtr /* client */
);
);
void
SRepXOpenDevice (
ClientPtr /* client */,
int /* size */,
xOpenDeviceReply * /* rep */
);
int /* size */ ,
xOpenDeviceReply * /* rep */
);
#endif /* OPENDEV_H */
......@@ -58,11 +58,11 @@ from The Open Group.
int
SProcXQueryDeviceState(client)
register ClientPtr client;
{
{
REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length);
return(ProcXQueryDeviceState(client));
}
return (ProcXQueryDeviceState(client));
}
/***********************************************************************
*
......@@ -73,20 +73,20 @@ SProcXQueryDeviceState(client)
int
ProcXQueryDeviceState(client)
register ClientPtr client;
{
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;
{
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);
......@@ -96,13 +96,13 @@ ProcXQueryDeviceState(client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid);
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)
......@@ -111,81 +111,81 @@ ProcXQueryDeviceState(client)
k = dev->key;
if (k != NULL)
{
total_length += sizeof (xKeyState);
total_length += sizeof(xKeyState);
num_classes++;
}
}
b = dev->button;
if (b != NULL)
{
total_length += sizeof (xButtonState);
total_length += sizeof(xButtonState);
num_classes++;
}
}
if (v != NULL)
{
total_length += (sizeof(xValuatorState) +
(v->numAxes * sizeof(int)));
num_classes++;
}
buf = (char *) malloc (total_length);
}
buf = (char *)malloc(total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
BadAlloc);
return Success;
}
}
savbuf = buf;
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)
{
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)
{
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++;
*((int *)buf) = *values++;
if (client->swapped)
{
swapl ((int *) buf);/* macro - braces needed */
}
buf += sizeof(int);
swapl((int *)buf); /* 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);
free (savbuf);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;
}
}
/***********************************************************************
*
......@@ -199,8 +199,8 @@ SRepXQueryDeviceState (client, size, rep)
ClientPtr client;
int size;
xQueryDeviceStateReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXQueryDeviceState(
ClientPtr /* client */
);
);
int
ProcXQueryDeviceState(
ClientPtr /* client */
);
);
void
SRepXQueryDeviceState (
ClientPtr /* client */,
int /* size */,
xQueryDeviceStateReply * /* rep */
);
int /* size */ ,
xQueryDeviceStateReply * /* rep */
);
#endif /* QUERYST_H */
......@@ -69,8 +69,8 @@ SOFTWARE.
#include "grabdev.h"
#include "selectev.h"
extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[];
extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[];
/***********************************************************************
*
......@@ -81,7 +81,7 @@ extern Mask ExtValidMasks[];
int
SProcXSelectExtensionEvent (client)
register ClientPtr client;
{
{
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
......@@ -91,8 +91,8 @@ register ClientPtr client;
stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return(ProcXSelectExtensionEvent(client));
}
return (ProcXSelectExtensionEvent(client));
}
/***********************************************************************
*
......@@ -103,46 +103,46 @@ register ClientPtr client;
int
ProcXSelectExtensionEvent (client)
register ClientPtr client;
{
int ret;
int i;
WindowPtr pWin;
struct tmask tmp[EMASKSIZE];
{
int ret;
int i;
WindowPtr pWin;
struct tmask tmp[EMASKSIZE];
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
if (stuff->length !=(sizeof(xSelectExtensionEventReq)>>2) + stuff->count)
{
SendErrorToClient (client, IReqCode, X_SelectExtensionEvent, 0,
BadLength);
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadLength);
return Success;
}
}
pWin = (WindowPtr) LookupWindow (stuff->window, client);
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin)
{
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadWindow);
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadWindow);
return Success;
}
}
if ((ret = CreateMaskFromList (client, (XEventClass *)&stuff[1],
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL, X_SelectExtensionEvent)) != Success)
return Success;
for (i=0; i<EMASKSIZE; i++)
for (i = 0; i < EMASKSIZE; i++)
if (tmp[i].dev != NULL)
{
if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask,
ExtExclusiveMasks[i], ExtValidMasks[i])) != Success)
{
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
ret);
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
ret);
return Success;
}
}
}
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSelectExtensionEvent (
ClientPtr /* client */
);
);
int
ProcXSelectExtensionEvent (
ClientPtr /* client */
);
);
#endif /* SELECTEV_H */
......@@ -70,7 +70,7 @@ SOFTWARE.
#include "grabdev.h"
#include "sendexev.h"
extern int lastEvent; /* Defined in extension.c */
extern int lastEvent; /* Defined in extension.c */
/***********************************************************************
*
......@@ -81,7 +81,7 @@ extern int lastEvent; /* Defined in extension.c */
int
SProcXSendExtensionEvent(client)
register ClientPtr client;
{
{
CARD32 *p;
register int i;
xEvent eventT;
......@@ -95,23 +95,23 @@ SProcXSendExtensionEvent(client)
swaps(&stuff->count);
if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
(stuff->num_events * (sizeof(xEvent) >> 2)))
return BadLength;
(stuff->num_events * (sizeof(xEvent) >> 2)))
return BadLength;
eventP = (xEvent *) &stuff[1];
eventP = (xEvent *) & stuff[1];
for (i=0; i<stuff->num_events; i++,eventP++)
{
proc = EventSwapVector[eventP->u.u.type & 0177];
if (proc == NotImplemented) /* no swapping proc; invalid event type? */
if (proc == NotImplemented) /* no swapping proc; invalid event type? */
return (BadValue);
(*proc)(eventP, &eventT);
(*proc) (eventP, &eventT);
*eventP = eventT;
}
}
p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
p = (CARD32 *) (((xEvent *) & stuff[1]) + stuff->num_events);
SwapLongs(p, stuff->count);
return(ProcXSendExtensionEvent(client));
}
return (ProcXSendExtensionEvent(client));
}
/***********************************************************************
*
......@@ -123,59 +123,59 @@ SProcXSendExtensionEvent(client)
int
ProcXSendExtensionEvent (client)
register ClientPtr client;
{
int ret;
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
struct tmask tmp[EMASKSIZE];
{
int ret;
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
struct tmask tmp[EMASKSIZE];
REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (stuff->length !=(sizeof(xSendExtensionEventReq)>>2) + stuff->count +
if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
(stuff->num_events * (sizeof (xEvent) >> 2)))
{
SendErrorToClient (client, IReqCode, X_SendExtensionEvent, 0,
BadLength);
return Success;
}
}
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
BadDevice);
return Success;
}
}
/*
the previous code here returned the unitialized variable ret,
so using Success we have defined returncode at least. FIXME:
Upstream works different here, we must check this!
*/
*/
if (stuff->num_events == 0)
/* return ret; */
return Success;
/* return ret; */
return Success;
/* The client's event type must be one defined by an extension. */
first = ((xEvent *) &stuff[1]);
if ( ! ((EXTENSION_EVENT_BASE <= first->u.u.type) &&
first = ((xEvent *) & stuff[1]);
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
(first->u.u.type < lastEvent)) )
{
client->errorValue = first->u.u.type;
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
BadValue);
return Success;
}
}
list = (XEventClass *) (first + stuff->num_events);
if ((ret = CreateMaskFromList (client, list, stuff->count, tmp, dev,
X_SendExtensionEvent)) != Success)
if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
X_SendExtensionEvent)) != Success)
return Success;
ret = (SendEvent (client, dev, stuff->destination,
ret = (SendEvent(client, dev, stuff->destination,
stuff->propagate, (xEvent *)&stuff[1], tmp[stuff->deviceid].mask,
stuff->num_events));
......@@ -183,4 +183,4 @@ ProcXSendExtensionEvent (client)
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSendExtensionEvent(
ClientPtr /* client */
);
);
int
ProcXSendExtensionEvent(
ClientPtr /* client */
);
);
#endif /* SENDEXEV_H */
......@@ -79,11 +79,11 @@ SOFTWARE.
int
SProcXSetDeviceButtonMapping(client)
register ClientPtr client;
{
{
REQUEST(xSetDeviceButtonMappingReq);
swaps(&stuff->length);
return(ProcXSetDeviceButtonMapping(client));
}
return (ProcXSetDeviceButtonMapping(client));
}
/***********************************************************************
*
......@@ -94,21 +94,21 @@ SProcXSetDeviceButtonMapping(client)
int
ProcXSetDeviceButtonMapping (client)
register ClientPtr client;
{
int ret;
xSetDeviceButtonMappingReply rep;
{
int ret;
xSetDeviceButtonMappingReply rep;
DeviceIntPtr dev;
REQUEST(xSetDeviceButtonMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
stuff->map_length + 3)>>2)
{
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
BadLength);
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
BadLength);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_SetDeviceButtonMapping;
......@@ -116,15 +116,15 @@ ProcXSetDeviceButtonMapping (client)
rep.sequenceNumber = client->sequence;
rep.status = MappingSuccess;
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
BadDevice);
return Success;
}
}
ret = SetButtonMapping (client, dev, stuff->map_length, (BYTE *)&stuff[1]);
ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]);
if (ret == BadValue || ret == BadMatch)
{
......@@ -136,12 +136,12 @@ ProcXSetDeviceButtonMapping (client)
{
rep.status = ret;
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
}
}
if (ret != MappingBusy)
SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
return Success;
}
}
/***********************************************************************
*
......@@ -155,8 +155,8 @@ SRepXSetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;
xSetDeviceButtonMappingReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSetDeviceButtonMapping(
ClientPtr /* client */
);
);
int
ProcXSetDeviceButtonMapping(
ClientPtr /* client */
);
);
void
SRepXSetDeviceButtonMapping(
ClientPtr /* client */,
int /* size */,
xSetDeviceButtonMappingReply * /* rep */
);
int /* size */ ,
xSetDeviceButtonMappingReply * /* rep */
);
#endif /* SETBMAP_H */
......@@ -76,11 +76,11 @@ SOFTWARE.
int
SProcXSetDeviceValuators(client)
register ClientPtr client;
{
{
REQUEST(xSetDeviceValuatorsReq);
swaps(&stuff->length);
return(ProcXSetDeviceValuators(client));
}
return (ProcXSetDeviceValuators(client));
}
/***********************************************************************
*
......@@ -91,9 +91,9 @@ SProcXSetDeviceValuators(client)
int
ProcXSetDeviceValuators(client)
register ClientPtr client;
{
{
DeviceIntPtr dev;
xSetDeviceValuatorsReply rep;
xSetDeviceValuatorsReply rep;
REQUEST(xSetDeviceValuatorsReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
......@@ -104,48 +104,48 @@ ProcXSetDeviceValuators(client)
rep.status = Success;
rep.sequenceNumber = client->sequence;
if (stuff->length !=(sizeof(xSetDeviceValuatorsReq)>>2) +
if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) +
stuff->num_valuators)
{
SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
BadLength);
return Success;
}
dev = LookupDeviceIntRec (stuff->deviceid);
}
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
BadDevice);
return Success;
}
}
if (dev->valuator == NULL)
{
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
BadMatch);
return Success;
}
}
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
{
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
BadValue);
return Success;
}
}
if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed;
else
rep.status = SetDeviceValuators (client, dev, (int *) &stuff[1],
rep.status = SetDeviceValuators(client, dev, (int *)&stuff[1],
stuff->first_valuator, stuff->num_valuators);
if (rep.status != Success && rep.status != AlreadyGrabbed)
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
rep.status);
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
rep.status);
else
WriteReplyToClient (client, sizeof (xSetDeviceValuatorsReply), &rep);
WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
return Success;
}
}
/***********************************************************************
*
......@@ -159,8 +159,8 @@ SRepXSetDeviceValuators (client, size, rep)
ClientPtr client;
int size;
xSetDeviceValuatorsReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSetDeviceValuators(
ClientPtr /* client */
);
);
int
ProcXSetDeviceValuators(
ClientPtr /* client */
);
);
void
SRepXSetDeviceValuators(
ClientPtr /* client */,
int /* size */,
xSetDeviceValuatorsReply * /* rep */
);
int /* size */ ,
xSetDeviceValuatorsReply * /* rep */
);
#endif /* SETDVAL_H */
......@@ -79,14 +79,14 @@ SOFTWARE.
int
SProcXSetDeviceFocus(client)
register ClientPtr client;
{
{
REQUEST(xSetDeviceFocusReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
swapl(&stuff->focus);
swapl(&stuff->time);
return(ProcXSetDeviceFocus(client));
}
return (ProcXSetDeviceFocus(client));
}
/***********************************************************************
*
......@@ -97,24 +97,24 @@ SProcXSetDeviceFocus(client)
int
ProcXSetDeviceFocus(client)
register ClientPtr client;
{
int ret;
register DeviceIntPtr dev;
{
int ret;
register DeviceIntPtr dev;
REQUEST(xSetDeviceFocusReq);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
dev = LookupDeviceIntRec (stuff->device);
dev = LookupDeviceIntRec(stuff->device);
if (dev==NULL || !dev->focus)
{
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
return Success;
}
}
ret = SetInputFocus (client, dev, stuff->focus, stuff->revertTo,
stuff->time, TRUE);
ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo,
stuff->time, TRUE);
if (ret != Success)
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSetDeviceFocus(
ClientPtr /* client */
);
);
int
ProcXSetDeviceFocus(
ClientPtr /* client */
);
);
#endif /* SETFOCUS_H */
......@@ -77,11 +77,11 @@ SOFTWARE.
int
SProcXSetDeviceModifierMapping(client)
register ClientPtr client;
{
{
REQUEST(xSetDeviceModifierMappingReq);
swaps(&stuff->length);
return(ProcXSetDeviceModifierMapping(client));
}
return (ProcXSetDeviceModifierMapping(client));
}
/***********************************************************************
*
......@@ -92,22 +92,22 @@ SProcXSetDeviceModifierMapping(client)
int
ProcXSetDeviceModifierMapping(client)
ClientPtr client;
{
int ret;
xSetDeviceModifierMappingReply rep;
DeviceIntPtr dev;
KeyClassPtr kp;
{
int ret;
xSetDeviceModifierMappingReply rep;
DeviceIntPtr dev;
KeyClassPtr kp;
REQUEST(xSetDeviceModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0,
BadDevice);
return Success;
}
}
rep.repType = X_Reply;
rep.RepType = X_SetDeviceModifierMapping;
......@@ -122,19 +122,19 @@ ProcXSetDeviceModifierMapping(client)
{
rep.success = ret;
if (ret == MappingSuccess)
SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),&rep);
}
else
{
if (ret==-1)
ret=BadValue;
SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,ret);
}
if (ret == -1)
ret = BadValue;
SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret);
}
return Success;
}
}
/***********************************************************************
*
......@@ -148,9 +148,9 @@ SRepXSetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;
xSetDeviceModifierMappingReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSetDeviceModifierMapping(
ClientPtr /* client */
);
);
int
ProcXSetDeviceModifierMapping(
ClientPtr /* client */
);
);
void
SRepXSetDeviceModifierMapping(
ClientPtr /* client */,
int /* size */,
xSetDeviceModifierMappingReply * /* rep */
);
int /* size */ ,
xSetDeviceModifierMappingReply * /* rep */
);
#endif /* SETMMAP_H */
......@@ -76,11 +76,11 @@ SOFTWARE.
int
SProcXSetDeviceMode(client)
register ClientPtr client;
{
{
REQUEST(xSetDeviceModeReq);
swaps(&stuff->length);
return(ProcXSetDeviceMode(client));
}
return (ProcXSetDeviceMode(client));
}
/***********************************************************************
*
......@@ -91,9 +91,9 @@ SProcXSetDeviceMode(client)
int
ProcXSetDeviceMode(client)
register ClientPtr client;
{
{
DeviceIntPtr dev;
xSetDeviceModeReply rep;
xSetDeviceModeReply rep;
REQUEST(xSetDeviceModeReq);
REQUEST_SIZE_MATCH(xSetDeviceModeReq);
......@@ -103,33 +103,33 @@ ProcXSetDeviceMode(client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient (client, IReqCode, X_SetDeviceMode, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice);
return Success;
}
}
if (dev->valuator == NULL)
{
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
return Success;
}
}
if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed;
else
rep.status = SetDeviceMode (client, dev, stuff->mode);
rep.status = SetDeviceMode(client, dev, stuff->mode);
if (rep.status == Success)
dev->valuator->mode = stuff->mode;
if (rep.status == Success)
dev->valuator->mode = stuff->mode;
else if (rep.status != AlreadyGrabbed)
{
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
return Success;
}
return Success;
}
WriteReplyToClient (client, sizeof (xSetDeviceModeReply), &rep);
WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
return Success;
}
}
/***********************************************************************
*
......@@ -143,8 +143,8 @@ SRepXSetDeviceMode (client, size, rep)
ClientPtr client;
int size;
xSetDeviceModeReply *rep;
{
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
}
......@@ -33,18 +33,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXSetDeviceMode(
ClientPtr /* client */
);
);
int
ProcXSetDeviceMode(
ClientPtr /* client */
);
);
void
SRepXSetDeviceMode(
ClientPtr /* client */,
int /* size */,
xSetDeviceModeReply * /* rep */
);
int /* size */ ,
xSetDeviceModeReply * /* rep */
);
#endif /* SETMODE_H */
......@@ -94,12 +94,12 @@ int
ChangeKeyboardDevice (old_dev, new_dev)
DeviceIntPtr old_dev;
DeviceIntPtr new_dev;
{
{
/***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/
return BadMatch;
}
}
/***********************************************************************
......@@ -138,7 +138,7 @@ ChangePointerDevice (
DeviceIntPtr new_dev,
unsigned char x,
unsigned char y)
{
{
/***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
......@@ -150,7 +150,7 @@ ChangePointerDevice (
axes_changed = FALSE;
*************************************************************************/
return BadMatch;
}
}
/***********************************************************************
*
......@@ -169,8 +169,8 @@ void
CloseInputDevice (d, client)
DeviceIntPtr d;
ClientPtr client;
{
}
{
}
/***********************************************************************
*
......@@ -200,7 +200,7 @@ CloseInputDevice (d, client)
void
AddOtherInputDevices ()
{
{
/**********************************************************************
for each uninitialized device, do something like:
......@@ -214,7 +214,7 @@ AddOtherInputDevices ()
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
************************************************************************/
}
}
/***********************************************************************
*
......@@ -243,8 +243,8 @@ OpenInputDevice (dev, client, status)
DeviceIntPtr dev;
ClientPtr client;
int *status;
{
}
{
}
/****************************************************************************
*
......@@ -263,9 +263,9 @@ SetDeviceMode (client, dev, mode)
register ClientPtr client;
DeviceIntPtr dev;
int mode;
{
{
return BadMatch;
}
}
/****************************************************************************
*
......@@ -286,9 +286,9 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
int *valuators;
int first_valuator;
int num_valuators;
{
{
return BadMatch;
}
}
/****************************************************************************
*
......@@ -305,10 +305,10 @@ ChangeDeviceControl (client, dev, control)
xDeviceCtl *control;
{
switch (control->control)
{
case DEVICE_RESOLUTION:
return (BadMatch);
default:
return (BadMatch);
}
{
case DEVICE_RESOLUTION:
return (BadMatch);
default:
return (BadMatch);
}
}
......@@ -75,13 +75,13 @@ SOFTWARE.
int
SProcXUngrabDevice(client)
register ClientPtr client;
{
{
REQUEST(xUngrabDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
swapl(&stuff->time);
return(ProcXUngrabDevice(client));
}
return (ProcXUngrabDevice(client));
}
/***********************************************************************
*
......@@ -92,26 +92,26 @@ register ClientPtr client;
int
ProcXUngrabDevice(client)
register ClientPtr client;
{
DeviceIntPtr dev;
GrabPtr grab;
TimeStamp time;
{
DeviceIntPtr dev;
GrabPtr grab;
TimeStamp time;
REQUEST(xUngrabDeviceReq);
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
dev = LookupDeviceIntRec (stuff->deviceid);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
return Success;
}
grab = dev->grab;
}
grab = dev->grab;
time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, dev->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client))
(*dev->DeactivateGrab)(dev);
(*dev->DeactivateGrab) (dev);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXUngrabDevice(
ClientPtr /* client */
);
);
int
ProcXUngrabDevice(
ClientPtr /* client */
);
);
#endif /* UNGRDEV_H */
......@@ -81,14 +81,14 @@ SOFTWARE.
int
SProcXUngrabDeviceButton(client)
register ClientPtr client;
{
{
REQUEST(xUngrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
return(ProcXUngrabDeviceButton(client));
}
return (ProcXUngrabDeviceButton(client));
}
/***********************************************************************
*
......@@ -99,44 +99,44 @@ SProcXUngrabDeviceButton(client)
int
ProcXUngrabDeviceButton(client)
ClientPtr client;
{
DeviceIntPtr dev;
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
{
DeviceIntPtr dev;
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
REQUEST(xUngrabDeviceButtonReq);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
dev = LookupDeviceIntRec (stuff->grabbed_device);
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadDevice);
return Success;
}
}
if (dev->button == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadMatch);
return Success;
}
}
if (stuff->modifier_device != UseXKeyboard)
{
mdev = LookupDeviceIntRec (stuff->modifier_device);
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadDevice);
return Success;
}
}
if (mdev->key == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadMatch);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadMatch);
return Success;
}
}
}
else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
......@@ -147,7 +147,7 @@ ProcXUngrabDeviceButton(client)
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadWindow);
return Success;
}
}
if ((stuff->modifiers != AnyModifier) &&
(stuff->modifiers & ~AllModifiersMask))
......@@ -155,7 +155,7 @@ ProcXUngrabDeviceButton(client)
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadValue);
return Success;
}
}
temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev;
......@@ -169,4 +169,4 @@ ProcXUngrabDeviceButton(client)
DeletePassiveGrabFromList(&temporaryGrab);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXUngrabDeviceButton(
ClientPtr /* client */
);
);
int
ProcXUngrabDeviceButton(
ClientPtr /* client */
);
);
#endif /* UNGRDEVB_H */
......@@ -81,14 +81,14 @@ SOFTWARE.
int
SProcXUngrabDeviceKey(client)
register ClientPtr client;
{
{
REQUEST(xUngrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
return(ProcXUngrabDeviceKey(client));
}
return (ProcXUngrabDeviceKey(client));
}
/***********************************************************************
*
......@@ -99,43 +99,43 @@ SProcXUngrabDeviceKey(client)
int
ProcXUngrabDeviceKey(client)
ClientPtr client;
{
DeviceIntPtr dev;
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
{
DeviceIntPtr dev;
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
REQUEST(xUngrabDeviceKeyReq);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
dev = LookupDeviceIntRec (stuff->grabbed_device);
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadDevice);
return Success;
}
}
if (dev->key == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
return Success;
}
}
if (stuff->modifier_device != UseXKeyboard)
{
mdev = LookupDeviceIntRec (stuff->modifier_device);
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadDevice);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadDevice);
return Success;
}
}
if (mdev->key == NULL)
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadMatch);
return Success;
}
}
}
else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
......@@ -146,7 +146,7 @@ ProcXUngrabDeviceKey(client)
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadWindow);
return Success;
}
}
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
(stuff->key < dev->key->curKeySyms.minKeyCode))
&& (stuff->key != AnyKey))
......@@ -154,19 +154,19 @@ ProcXUngrabDeviceKey(client)
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadValue);
return Success;
}
}
if ((stuff->modifiers != AnyModifier) &&
(stuff->modifiers & ~AllModifiersMask))
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadValue);
return Success;
}
}
temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev;
temporaryGrab.window = pWin;
temporaryGrab.type = DeviceKeyPress;
temporaryGrab.type = DeviceKeyPress;
temporaryGrab.modifierDevice = mdev;
temporaryGrab.modifiersDetail.exact = stuff->modifiers;
temporaryGrab.modifiersDetail.pMask = NULL;
......@@ -175,4 +175,4 @@ ProcXUngrabDeviceKey(client)
DeletePassiveGrabFromList(&temporaryGrab);
return Success;
}
}
......@@ -33,11 +33,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
SProcXUngrabDeviceKey(
ClientPtr /* client */
);
);
int
ProcXUngrabDeviceKey(
ClientPtr /* client */
);
);
#endif /* UNGRDEVK_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment