Unverified Commit 05152b78 authored by Mihai Moldovan's avatar Mihai Moldovan

Merge branch 'uli42-pr/update_xi' into arctica-3.6.x

parents e247900e 4598c0c3
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "allowev.h" #include "allowev.h"
...@@ -75,15 +75,14 @@ SOFTWARE. ...@@ -75,15 +75,14 @@ SOFTWARE.
*/ */
int int
SProcXAllowDeviceEvents(client) SProcXAllowDeviceEvents(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xAllowDeviceEventsReq); REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time); swapl(&stuff->time);
return(ProcXAllowDeviceEvents(client)); return (ProcXAllowDeviceEvents(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -92,48 +91,44 @@ SProcXAllowDeviceEvents(client) ...@@ -92,48 +91,44 @@ SProcXAllowDeviceEvents(client)
*/ */
int int
ProcXAllowDeviceEvents(client) ProcXAllowDeviceEvents(register ClientPtr client)
register ClientPtr client; {
{ TimeStamp time;
TimeStamp time; DeviceIntPtr thisdev;
DeviceIntPtr thisdev;
REQUEST(xAllowDeviceEventsReq); REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
thisdev = LookupDeviceIntRec (stuff->deviceid); thisdev = LookupDeviceIntRec(stuff->deviceid);
if (thisdev == NULL) if (thisdev == NULL) {
{
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice); SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
return Success; return Success;
} }
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode) switch (stuff->mode) {
{ case ReplayThisDevice:
case ReplayThisDevice: AllowSome(client, time, thisdev, NOT_GRABBED);
AllowSome(client, time, thisdev, NOT_GRABBED); break;
break; case SyncThisDevice:
case SyncThisDevice: AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT); break;
break; case AsyncThisDevice:
case AsyncThisDevice: AllowSome(client, time, thisdev, THAWED);
AllowSome(client, time, thisdev, THAWED); break;
break; case AsyncOtherDevices:
case AsyncOtherDevices: AllowSome(client, time, thisdev, THAW_OTHERS);
AllowSome(client, time, thisdev, THAW_OTHERS); break;
break; case SyncAll:
case SyncAll: AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT); break;
break; case AsyncAll:
case AsyncAll: AllowSome(client, time, thisdev, THAWED_BOTH);
AllowSome(client, time, thisdev, THAWED_BOTH); break;
break; default:
default: SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue);
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, client->errorValue = stuff->mode;
BadValue); return Success;
client->errorValue = stuff->mode;
return Success;
}
return Success;
} }
return Success;
}
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef ALLOWEV_H #ifndef ALLOWEV_H
#define ALLOWEV_H 1 #define ALLOWEV_H 1
int int SProcXAllowDeviceEvents(ClientPtr /* client */
SProcXAllowDeviceEvents( );
ClientPtr /* client */
); int ProcXAllowDeviceEvents(ClientPtr /* client */
);
int
ProcXAllowDeviceEvents(
ClientPtr /* client */
);
#endif /* ALLOWEV_H */ #endif /* ALLOWEV_H */
...@@ -55,15 +55,15 @@ SOFTWARE. ...@@ -55,15 +55,15 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> /* control constants */ #include <nx-X11/extensions/XIproto.h> /* control constants */
#include "XIstubs.h" #include "XIstubs.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "chgdctl.h" #include "chgdctl.h"
...@@ -76,15 +76,14 @@ SOFTWARE. ...@@ -76,15 +76,14 @@ SOFTWARE.
*/ */
int int
SProcXChangeDeviceControl(client) SProcXChangeDeviceControl(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xChangeDeviceControlReq); REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl)); REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control); swaps(&stuff->control);
return(ProcXChangeDeviceControl(client)); return (ProcXChangeDeviceControl(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -93,9 +92,8 @@ SProcXChangeDeviceControl(client) ...@@ -93,9 +92,8 @@ SProcXChangeDeviceControl(client)
*/ */
int int
ProcXChangeDeviceControl(client) ProcXChangeDeviceControl(ClientPtr client)
ClientPtr client; {
{
unsigned len; unsigned len;
int i, status; int i, status;
DeviceIntPtr dev; DeviceIntPtr dev;
...@@ -107,89 +105,73 @@ ProcXChangeDeviceControl(client) ...@@ -107,89 +105,73 @@ ProcXChangeDeviceControl(client)
REQUEST(xChangeDeviceControlReq); REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl)); REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
len = stuff->length - (sizeof(xChangeDeviceControlReq) >>2); len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_ChangeDeviceControl; rep.RepType = X_ChangeDeviceControl;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
switch (stuff->control) switch (stuff->control) {
{ case DEVICE_RESOLUTION:
case DEVICE_RESOLUTION: r = (xDeviceResolutionCtl *) & stuff[1];
r = (xDeviceResolutionCtl *) &stuff[1]; if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) ||
if ((len < (sizeof(xDeviceResolutionCtl)>>2)) || (len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) {
(len != (sizeof(xDeviceResolutionCtl)>>2) + SendErrorToClient(client, IReqCode, X_ChangeDeviceControl,
r->num_valuators)) 0, BadLength);
{ return Success;
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, }
0, BadLength); if (!dev->valuator) {
return Success; SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
} BadMatch);
if (!dev->valuator) return Success;
{ }
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0, if ((dev->grab) && !SameClient(dev->grab, client)) {
BadMatch); rep.status = AlreadyGrabbed;
return Success; WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
} return Success;
if ((dev->grab) && !SameClient(dev->grab, client)) }
{ resolution = (CARD32 *) (r + 1);
rep.status = AlreadyGrabbed; if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
&rep); BadValue);
return Success; return Success;
} }
resolution = (CARD32 *) (r + 1); status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) if (status == Success) {
{ a = &dev->valuator->axes[r->first_valuator];
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0, for (i = 0; i < r->num_valuators; i++)
BadValue); if (*(resolution + i) < (a + i)->min_resolution ||
return Success; *(resolution + i) > (a + i)->max_resolution) {
} SendErrorToClient(client, IReqCode,
status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r); X_ChangeDeviceControl, 0, BadValue);
if (status == Success) return Success;
{
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++;
}
else if (status == DeviceBusy)
{
rep.status = DeviceBusy;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
}
else
{
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
} }
break; for (i = 0; i < r->num_valuators; i++)
default: (a++)->resolution = *resolution++;
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0, } else if (status == DeviceBusy) {
BadValue); rep.status = DeviceBusy;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
return Success;
} else {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success; return Success;
} }
break;
default:
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
return Success;
}
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -199,13 +181,10 @@ ProcXChangeDeviceControl(client) ...@@ -199,13 +181,10 @@ ProcXChangeDeviceControl(client)
*/ */
void void
SRepXChangeDeviceControl (client, size, rep) SRepXChangeDeviceControl(ClientPtr client, int size,
ClientPtr client; xChangeDeviceControlReply * rep)
int size; {
xChangeDeviceControlReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGDCTL_H #ifndef CHGDCTL_H
#define CHGDCTL_H 1 #define CHGDCTL_H 1
int int SProcXChangeDeviceControl(ClientPtr /* client */
SProcXChangeDeviceControl( );
ClientPtr /* client */
); int ProcXChangeDeviceControl(ClientPtr /* client */
);
int
ProcXChangeDeviceControl( void SRepXChangeDeviceControl(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xChangeDeviceControlReply * /* rep */
);
void
SRepXChangeDeviceControl (
ClientPtr /* client */,
int /* size */,
xChangeDeviceControlReply * /* rep */
);
#endif /* CHGDCTL_H */ #endif /* CHGDCTL_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> /* control constants */ #include <nx-X11/extensions/XIproto.h> /* control constants */
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "chgfctl.h" #include "chgfctl.h"
...@@ -77,15 +77,14 @@ SOFTWARE. ...@@ -77,15 +77,14 @@ SOFTWARE.
*/ */
int int
SProcXChangeFeedbackControl(client) SProcXChangeFeedbackControl(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xChangeFeedbackControlReq); REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask); swapl(&stuff->mask);
return(ProcXChangeFeedbackControl(client)); return (ProcXChangeFeedbackControl(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -94,9 +93,8 @@ SProcXChangeFeedbackControl(client) ...@@ -94,9 +93,8 @@ SProcXChangeFeedbackControl(client)
*/ */
int int
ProcXChangeFeedbackControl(client) ProcXChangeFeedbackControl(ClientPtr client)
ClientPtr client; {
{
unsigned len; unsigned len;
DeviceIntPtr dev; DeviceIntPtr dev;
KbdFeedbackPtr k; KbdFeedbackPtr k;
...@@ -109,117 +107,109 @@ ProcXChangeFeedbackControl(client) ...@@ -109,117 +107,109 @@ ProcXChangeFeedbackControl(client)
REQUEST(xChangeFeedbackControlReq); REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >>2); len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
switch (stuff->feedbackid) switch (stuff->feedbackid) {
{ case KbdFeedbackClass:
case KbdFeedbackClass: if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
if (len != (sizeof(xKbdFeedbackCtl)>>2)) SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
{ 0, BadLength);
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, return Success;
0, BadLength); }
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; return Success;
} }
for (k=dev->kbdfeed; k; k=k->next) break;
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id) case PtrFeedbackClass:
{ if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]); SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
return Success; 0, BadLength);
} return Success;
break; }
case PtrFeedbackClass: for (p = dev->ptrfeed; p; p = p->next)
if (len != (sizeof(xPtrFeedbackCtl)>>2)) if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
{ ChangePtrFeedback(client, dev, stuff->mask, p,
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, (xPtrFeedbackCtl *) & stuff[1]);
0, BadLength);
return Success; return Success;
} }
for (p=dev->ptrfeed; p; p=p->next) break;
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id) case StringFeedbackClass:
{ {
ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]); xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
return Success;
}
break;
case StringFeedbackClass:
{
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
if (client->swapped) if (client->swapped)
{ {
if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2) if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2)
return BadLength; return BadLength;
swaps(&f->num_keysyms); swaps(&f->num_keysyms);
} }
if (len != ((sizeof(xStringFeedbackCtl)>>2) + f->num_keysyms)) if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
{ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadLength);
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; 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;
} }
case IntegerFeedbackClass: break;
if (len != (sizeof(xIntegerFeedbackCtl)>>2)) }
{ case IntegerFeedbackClass:
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
0, BadLength); SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
return Success; 0, BadLength);
} return Success;
for (i=dev->intfeed; i; i=i->next) }
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id) 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]); ChangeIntegerFeedback(client, dev, stuff->mask, i,
return Success; (xIntegerFeedbackCtl *) & stuff[1]);
}
break;
case LedFeedbackClass:
if (len != (sizeof(xLedFeedbackCtl)>>2))
{
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success; return Success;
} }
for (l=dev->leds; l; l=l->next) break;
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id) case LedFeedbackClass:
{ if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]); SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
return Success; 0, BadLength);
} return Success;
break; }
case BellFeedbackClass: for (l = dev->leds; l; l = l->next)
if (len != (sizeof(xBellFeedbackCtl)>>2)) if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
{ ChangeLedFeedback(client, dev, stuff->mask, l,
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, (xLedFeedbackCtl *) & stuff[1]);
0, BadLength);
return Success; return Success;
} }
for (b=dev->bell; b; b=b->next) break;
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id) case BellFeedbackClass:
{ if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]); SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
return Success; 0, BadLength);
} return Success;
break;
default:
break;
} }
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;
}
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
return Success; return Success;
} }
/****************************************************************************** /******************************************************************************
* *
...@@ -228,132 +218,110 @@ ProcXChangeFeedbackControl(client) ...@@ -228,132 +218,110 @@ ProcXChangeFeedbackControl(client)
*/ */
int int
ChangeKbdFeedback (client, dev, mask, k, f) ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
ClientPtr client; KbdFeedbackPtr k, xKbdFeedbackCtl * f)
DeviceIntPtr dev; {
unsigned long mask;
KbdFeedbackPtr k;
xKbdFeedbackCtl *f;
{
KeybdCtrl kctrl; KeybdCtrl kctrl;
int t; int t;
int key = DO_ALL; int key = DO_ALL;
if (client->swapped) if (client->swapped) {
{
swaps(&f->length); swaps(&f->length);
swaps(&f->pitch); swaps(&f->pitch);
swaps(&f->duration); swaps(&f->duration);
swapl(&f->led_mask); swapl(&f->led_mask);
swapl(&f->led_values); swapl(&f->led_values);
} }
kctrl = k->ctrl; kctrl = k->ctrl;
if (mask & DvKeyClickPercent) if (mask & DvKeyClickPercent) {
{
t = f->click; t = f->click;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.click; t = defaultKeyboardControl.click;
else if (t < 0 || t > 100) else if (t < 0 || t > 100) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} }
kctrl.click = t; kctrl.click = t;
} }
if (mask & DvPercent) if (mask & DvPercent) {
{
t = f->percent; t = f->percent;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.bell; t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) else if (t < 0 || t > 100) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
}
kctrl.bell = t;
} }
kctrl.bell = t;
}
if (mask & DvPitch) if (mask & DvPitch) {
{
t = f->pitch; t = f->pitch;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.bell_pitch; t = defaultKeyboardControl.bell_pitch;
else if (t < 0) else if (t < 0) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
}
kctrl.bell_pitch = t;
} }
kctrl.bell_pitch = t;
}
if (mask & DvDuration) if (mask & DvDuration) {
{
t = f->duration; t = f->duration;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.bell_duration; t = defaultKeyboardControl.bell_duration;
else if (t < 0) else if (t < 0) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} }
kctrl.bell_duration = t; kctrl.bell_duration = t;
} }
if (mask & DvLed) if (mask & DvLed) {
{
kctrl.leds &= ~(f->led_mask); kctrl.leds &= ~(f->led_mask);
kctrl.leds |= (f->led_mask & f->led_values); kctrl.leds |= (f->led_mask & f->led_values);
} }
if (mask & DvKey) if (mask & DvKey) {
{
key = (KeyCode) f->key; key = (KeyCode) f->key;
if (key < 8 || key > 255) if (key < 8 || key > 255) {
{
client->errorValue = key; client->errorValue = key;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} }
if (!(mask & DvAutoRepeatMode)) if (!(mask & DvAutoRepeatMode)) {
{ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
BadMatch);
return Success; return Success;
}
} }
}
if (mask & DvAutoRepeatMode) if (mask & DvAutoRepeatMode) {
{
int inx = (key >> 3); int inx = (key >> 3);
int kmask = (1 << (key & 7)); int kmask = (1 << (key & 7));
t = (CARD8) f->auto_repeat_mode; t = (CARD8) f->auto_repeat_mode;
if (t == AutoRepeatModeOff) if (t == AutoRepeatModeOff) {
{
if (key == DO_ALL) if (key == DO_ALL)
kctrl.autoRepeat = FALSE; kctrl.autoRepeat = FALSE;
else else
kctrl.autoRepeats[inx] &= ~kmask; kctrl.autoRepeats[inx] &= ~kmask;
} } else if (t == AutoRepeatModeOn) {
else if (t == AutoRepeatModeOn)
{
if (key == DO_ALL) if (key == DO_ALL)
kctrl.autoRepeat = TRUE; kctrl.autoRepeat = TRUE;
else else
kctrl.autoRepeats[inx] |= kmask; kctrl.autoRepeats[inx] |= kmask;
} } else if (t == AutoRepeatModeDefault) {
else if (t == AutoRepeatModeDefault)
{
if (key == DO_ALL) if (key == DO_ALL)
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat; kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else else
...@@ -361,20 +329,18 @@ ChangeKbdFeedback (client, dev, mask, k, f) ...@@ -361,20 +329,18 @@ ChangeKbdFeedback (client, dev, mask, k, f)
kctrl.autoRepeats[inx] = kctrl.autoRepeats[inx] =
(kctrl.autoRepeats[inx] & ~kmask) | (kctrl.autoRepeats[inx] & ~kmask) |
(defaultKeyboardControl.autoRepeats[inx] & kmask); (defaultKeyboardControl.autoRepeats[inx] & kmask);
} } else {
else
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} }
} }
k->ctrl = kctrl; k->ctrl = kctrl;
(*k->CtrlProc)(dev, &k->ctrl); (*k->CtrlProc) (dev, &k->ctrl);
return Success; return Success;
} }
/****************************************************************************** /******************************************************************************
* *
...@@ -383,79 +349,68 @@ ChangeKbdFeedback (client, dev, mask, k, f) ...@@ -383,79 +349,68 @@ ChangeKbdFeedback (client, dev, mask, k, f)
*/ */
int int
ChangePtrFeedback (client, dev, mask, p, f) ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
ClientPtr client; PtrFeedbackPtr p, xPtrFeedbackCtl * f)
DeviceIntPtr dev; {
unsigned long mask; PtrCtrl pctrl; /* might get BadValue part way through */
PtrFeedbackPtr p;
xPtrFeedbackCtl *f;
{
PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped) if (client->swapped) {
{
swaps(&f->length); swaps(&f->length);
swaps(&f->num); swaps(&f->num);
swaps(&f->denom); swaps(&f->denom);
swaps(&f->thresh); swaps(&f->thresh);
} }
pctrl = p->ctrl; pctrl = p->ctrl;
if (mask & DvAccelNum) if (mask & DvAccelNum) {
{ int accelNum;
int accelNum;
accelNum = f->num; accelNum = f->num;
if (accelNum == -1) if (accelNum == -1)
pctrl.num = defaultPointerControl.num; pctrl.num = defaultPointerControl.num;
else if (accelNum < 0) else if (accelNum < 0) {
{
client->errorValue = accelNum; client->errorValue = accelNum;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} } else
else pctrl.num = accelNum; pctrl.num = accelNum;
} }
if (mask & DvAccelDenom) if (mask & DvAccelDenom) {
{ int accelDenom;
int accelDenom;
accelDenom = f->denom; accelDenom = f->denom;
if (accelDenom == -1) if (accelDenom == -1)
pctrl.den = defaultPointerControl.den; pctrl.den = defaultPointerControl.den;
else if (accelDenom <= 0) else if (accelDenom <= 0) {
{
client->errorValue = accelDenom; client->errorValue = accelDenom;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} } else
else pctrl.den = accelDenom; pctrl.den = accelDenom;
} }
if (mask & DvThreshold) if (mask & DvThreshold) {
{ int threshold;
int threshold;
threshold = f->thresh; threshold = f->thresh;
if (threshold == -1) if (threshold == -1)
pctrl.threshold = defaultPointerControl.threshold; pctrl.threshold = defaultPointerControl.threshold;
else if (threshold < 0) else if (threshold < 0) {
{
client->errorValue = threshold; client->errorValue = threshold;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} } else
else pctrl.threshold = threshold; pctrl.threshold = threshold;
} }
p->ctrl = pctrl; p->ctrl = pctrl;
(*p->CtrlProc)(dev, &p->ctrl); (*p->CtrlProc) (dev, &p->ctrl);
return Success; return Success;
} }
/****************************************************************************** /******************************************************************************
* *
...@@ -464,23 +419,19 @@ ChangePtrFeedback (client, dev, mask, p, f) ...@@ -464,23 +419,19 @@ ChangePtrFeedback (client, dev, mask, p, f)
*/ */
int int
ChangeIntegerFeedback (client, dev, mask, i, f) ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
ClientPtr client; long unsigned int mask, IntegerFeedbackPtr i,
DeviceIntPtr dev; xIntegerFeedbackCtl * f)
unsigned long mask; {
IntegerFeedbackPtr i; if (client->swapped) {
xIntegerFeedbackCtl *f;
{
if (client->swapped)
{
swaps(&f->length); swaps(&f->length);
swapl(&f->int_to_display); swapl(&f->int_to_display);
} }
i->ctrl.integer_displayed = f->int_to_display; i->ctrl.integer_displayed = f->int_to_display;
(*i->CtrlProc)(dev, &i->ctrl); (*i->CtrlProc) (dev, &i->ctrl);
return Success; return Success;
} }
/****************************************************************************** /******************************************************************************
* *
...@@ -489,49 +440,42 @@ ChangeIntegerFeedback (client, dev, mask, i, f) ...@@ -489,49 +440,42 @@ ChangeIntegerFeedback (client, dev, mask, i, f)
*/ */
int int
ChangeStringFeedback (client, dev, mask, s, f) ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
ClientPtr client; long unsigned int mask, StringFeedbackPtr s,
DeviceIntPtr dev; xStringFeedbackCtl * f)
unsigned long mask; {
StringFeedbackPtr s; int i, j;
xStringFeedbackCtl *f; KeySym *syms, *sup_syms;
{
int i, j; syms = (KeySym *) (f + 1);
KeySym *syms, *sup_syms; if (client->swapped) {
syms = (KeySym *) (f+1);
if (client->swapped)
{
swaps(&f->length); /* swapped num_keysyms in calling proc */ swaps(&f->length); /* swapped num_keysyms in calling proc */
SwapLongs((CARD32 *) syms, f->num_keysyms); SwapLongs((CARD32 *) syms, f->num_keysyms);
} }
if (f->num_keysyms > s->ctrl.max_symbols) if (f->num_keysyms > s->ctrl.max_symbols) {
{ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue);
BadValue);
return Success; return Success;
} }
sup_syms = s->ctrl.symbols_supported; sup_syms = s->ctrl.symbols_supported;
for (i=0; i<f->num_keysyms; i++) for (i = 0; i < f->num_keysyms; i++) {
{ for (j = 0; j < s->ctrl.num_symbols_supported; j++)
for (j=0; j<s->ctrl.num_symbols_supported; j++) if (*(syms + i) == *(sup_syms + j))
if (*(syms+i) == *(sup_syms+j))
break; break;
if (j==s->ctrl.num_symbols_supported) if (j == s->ctrl.num_symbols_supported) {
{ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
BadMatch);
return Success; return Success;
}
} }
}
s->ctrl.num_symbols_displayed = f->num_keysyms; s->ctrl.num_symbols_displayed = f->num_keysyms;
for (i=0; i<f->num_keysyms; i++) for (i = 0; i < f->num_keysyms; i++)
*(s->ctrl.symbols_displayed+i) = *(syms+i); *(s->ctrl.symbols_displayed + i) = *(syms + i);
(*s->CtrlProc)(dev, &s->ctrl); (*s->CtrlProc) (dev, &s->ctrl);
return Success; return Success;
} }
/****************************************************************************** /******************************************************************************
* *
...@@ -540,72 +484,62 @@ ChangeStringFeedback (client, dev, mask, s, f) ...@@ -540,72 +484,62 @@ ChangeStringFeedback (client, dev, mask, s, f)
*/ */
int int
ChangeBellFeedback (client, dev, mask, b, f) ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
ClientPtr client; long unsigned int mask, BellFeedbackPtr b,
DeviceIntPtr dev; xBellFeedbackCtl * f)
unsigned long mask; {
BellFeedbackPtr b;
xBellFeedbackCtl *f;
{
int t; int t;
BellCtrl bctrl; /* might get BadValue part way through */ BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped) if (client->swapped) {
{
swaps(&f->length); swaps(&f->length);
swaps(&f->pitch); swaps(&f->pitch);
swaps(&f->duration); swaps(&f->duration);
} }
bctrl = b->ctrl; bctrl = b->ctrl;
if (mask & DvPercent) if (mask & DvPercent) {
{
t = f->percent; t = f->percent;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.bell; t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) else if (t < 0 || t > 100) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
}
bctrl.percent = t;
} }
bctrl.percent = t;
}
if (mask & DvPitch) if (mask & DvPitch) {
{
t = f->pitch; t = f->pitch;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.bell_pitch; t = defaultKeyboardControl.bell_pitch;
else if (t < 0) else if (t < 0) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
}
bctrl.pitch = t;
} }
bctrl.pitch = t;
}
if (mask & DvDuration) if (mask & DvDuration) {
{
t = f->duration; t = f->duration;
if (t == -1) if (t == -1)
t = defaultKeyboardControl.bell_duration; t = defaultKeyboardControl.bell_duration;
else if (t < 0) else if (t < 0) {
{
client->errorValue = t; client->errorValue = t;
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue); BadValue);
return Success; return Success;
} }
bctrl.duration = t; bctrl.duration = t;
} }
b->ctrl = bctrl; b->ctrl = bctrl;
(*b->CtrlProc)(dev, &b->ctrl); (*b->CtrlProc) (dev, &b->ctrl);
return Success; return Success;
} }
/****************************************************************************** /******************************************************************************
* *
...@@ -614,32 +548,26 @@ ChangeBellFeedback (client, dev, mask, b, f) ...@@ -614,32 +548,26 @@ ChangeBellFeedback (client, dev, mask, b, f)
*/ */
int int
ChangeLedFeedback (client, dev, mask, l, f) ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
ClientPtr client; LedFeedbackPtr l, xLedFeedbackCtl * f)
DeviceIntPtr dev; {
unsigned long mask; LedCtrl lctrl; /* might get BadValue part way through */
LedFeedbackPtr l;
xLedFeedbackCtl *f;
{
LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped) if (client->swapped) {
{
swaps(&f->length); swaps(&f->length);
swapl(&f->led_values); swapl(&f->led_values);
swapl(&f->led_mask); swapl(&f->led_mask);
} }
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */ f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
f->led_values &= l->ctrl.led_mask; /* set only supported leds */ f->led_values &= l->ctrl.led_mask; /* set only supported leds */
if (mask & DvLed) if (mask & DvLed) {
{
lctrl.led_mask = f->led_mask; lctrl.led_mask = f->led_mask;
lctrl.led_values = f->led_values; lctrl.led_values = f->led_values;
(*l->CtrlProc)(dev, &lctrl); (*l->CtrlProc) (dev, &lctrl);
l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */ 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->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
} }
return Success; return Success;
} }
...@@ -30,68 +30,52 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,68 +30,52 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGFCTL_H #ifndef CHGFCTL_H
#define CHGFCTL_H 1 #define CHGFCTL_H 1
int int SProcXChangeFeedbackControl(ClientPtr /* client */
SProcXChangeFeedbackControl( );
ClientPtr /* client */
); int ProcXChangeFeedbackControl(ClientPtr /* client */
);
int
ProcXChangeFeedbackControl( int ChangeKbdFeedback(ClientPtr /* client */ ,
ClientPtr /* client */ DeviceIntPtr /* dev */ ,
); unsigned long /* mask */ ,
KbdFeedbackPtr /* k */ ,
int xKbdFeedbackCtl * /* f */
ChangeKbdFeedback ( );
ClientPtr /* client */,
DeviceIntPtr /* dev */, int ChangePtrFeedback(ClientPtr /* client */ ,
unsigned long /* mask */, DeviceIntPtr /* dev */ ,
KbdFeedbackPtr /* k */, unsigned long /* mask */ ,
xKbdFeedbackCtl * /* f */ PtrFeedbackPtr /* p */ ,
); xPtrFeedbackCtl * /* f */
);
int
ChangePtrFeedback ( int ChangeIntegerFeedback(ClientPtr /* client */ ,
ClientPtr /* client */, DeviceIntPtr /* dev */ ,
DeviceIntPtr /* dev */, unsigned long /* mask */ ,
unsigned long /* mask */, IntegerFeedbackPtr /* i */ ,
PtrFeedbackPtr /* p */, xIntegerFeedbackCtl * /* f */
xPtrFeedbackCtl * /* f */ );
);
int ChangeStringFeedback(ClientPtr /* client */ ,
int DeviceIntPtr /* dev */ ,
ChangeIntegerFeedback ( unsigned long /* mask */ ,
ClientPtr /* client */, StringFeedbackPtr /* s */ ,
DeviceIntPtr /* dev */, xStringFeedbackCtl * /* f */
unsigned long /* mask */, );
IntegerFeedbackPtr /* i */,
xIntegerFeedbackCtl * /* f */ int ChangeBellFeedback(ClientPtr /* client */ ,
); DeviceIntPtr /* dev */ ,
unsigned long /* mask */ ,
int BellFeedbackPtr /* b */ ,
ChangeStringFeedback ( xBellFeedbackCtl * /* f */
ClientPtr /* client */, );
DeviceIntPtr /* dev */,
unsigned long /* mask */, int ChangeLedFeedback(ClientPtr /* client */ ,
StringFeedbackPtr /* s */, DeviceIntPtr /* dev */ ,
xStringFeedbackCtl * /* f */ unsigned long /* mask */ ,
); LedFeedbackPtr /* l */ ,
xLedFeedbackCtl * /* f */
int );
ChangeBellFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
BellFeedbackPtr /* b */,
xBellFeedbackCtl * /* f */
);
int
ChangeLedFeedback (
ClientPtr /* client */,
DeviceIntPtr /* dev */,
unsigned long /* mask */,
LedFeedbackPtr /* l */,
xLedFeedbackCtl * /* f */
);
#endif /* CHGFCTL_H */ #endif /* CHGFCTL_H */
...@@ -55,15 +55,15 @@ SOFTWARE. ...@@ -55,15 +55,15 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "globals.h" #include "globals.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
...@@ -78,14 +78,13 @@ SOFTWARE. ...@@ -78,14 +78,13 @@ SOFTWARE.
*/ */
int int
SProcXChangeKeyboardDevice(client) SProcXChangeKeyboardDevice(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xChangeKeyboardDeviceReq); REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return(ProcXChangeKeyboardDevice(client)); return (ProcXChangeKeyboardDevice(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -95,17 +94,16 @@ SProcXChangeKeyboardDevice(client) ...@@ -95,17 +94,16 @@ SProcXChangeKeyboardDevice(client)
*/ */
int int
ProcXChangeKeyboardDevice (client) ProcXChangeKeyboardDevice(register ClientPtr client)
register ClientPtr client; {
{ int i;
int i; DeviceIntPtr xkbd = inputInfo.keyboard;
DeviceIntPtr xkbd = inputInfo.keyboard; DeviceIntPtr dev;
DeviceIntPtr dev; FocusClassPtr xf = xkbd->focus;
FocusClassPtr xf = xkbd->focus; FocusClassPtr df;
FocusClassPtr df; KeyClassPtr k;
KeyClassPtr k; xChangeKeyboardDeviceReply rep;
xChangeKeyboardDeviceReply rep; changeDeviceNotify ev;
changeDeviceNotify ev;
REQUEST(xChangeKeyboardDeviceReq); REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
...@@ -115,79 +113,75 @@ ProcXChangeKeyboardDevice (client) ...@@ -115,79 +113,75 @@ ProcXChangeKeyboardDevice (client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{
rep.status = -1; rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice); BadDevice);
return Success; return Success;
} }
k = dev->key; k = dev->key;
if (k == NULL) if (k == NULL) {
{
rep.status = -1; rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadMatch); BadMatch);
return Success; return Success;
} }
if (((dev->grab) && !SameClient(dev->grab, client)) || if (((dev->grab) && !SameClient(dev->grab, client)) ||
((xkbd->grab) && !SameClient(xkbd->grab, client))) ((xkbd->grab) && !SameClient(xkbd->grab, client)))
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen && 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.frozen &&
xkbd->sync.other && !SameClient(xkbd->sync.other, client))) xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
rep.status = GrabFrozen; rep.status = GrabFrozen;
else else {
{ if (ChangeKeyboardDevice(xkbd, dev) != Success) {
if (ChangeKeyboardDevice (xkbd, dev) != Success) SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
{ BadDevice);
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
return Success; return Success;
} }
if (!dev->focus) if (!dev->focus)
InitFocusClassDeviceStruct (dev); InitFocusClassDeviceStruct(dev);
if (!dev->kbdfeed) if (!dev->kbdfeed)
InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr)NoopDDA, InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA,
(KbdCtrlProcPtr)NoopDDA); (KbdCtrlProcPtr) NoopDDA);
df = dev->focus; df = dev->focus;
df->win = xf->win; df->win = xf->win;
df->revert = xf->revert; df->revert = xf->revert;
df->time = xf->time; df->time = xf->time;
df->traceGood = xf->traceGood; df->traceGood = xf->traceGood;
if (df->traceSize != xf->traceSize) if (df->traceSize != xf->traceSize) {
{ Must_have_memory = TRUE; /* XXX */
Must_have_memory = TRUE; /* XXX */ df->trace = (WindowPtr *) realloc(df->trace,
df->trace = (WindowPtr *) realloc(df->trace, xf->traceSize *
xf->traceSize * sizeof(WindowPtr)); sizeof(WindowPtr));
Must_have_memory = FALSE; /* XXX */ Must_have_memory = FALSE; /* XXX */
} }
df->traceSize = xf->traceSize; df->traceSize = xf->traceSize;
for (i=0; i<df->traceSize; i++) for (i = 0; i < df->traceSize; i++)
df->trace[i] = xf->trace[i]; df->trace[i] = xf->trace[i];
RegisterOtherDevice (xkbd); RegisterOtherDevice(xkbd);
RegisterKeyboardDevice (dev); RegisterKeyboardDevice(dev);
ev.type = ChangeDeviceNotify; ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid; ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.request = NewKeyboard; ev.request = NewKeyboard;
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1); SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode, SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode,
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client); k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode +
1, client);
rep.status = 0; rep.status = 0;
} }
WriteReplyToClient (client, sizeof (xChangeKeyboardDeviceReply), WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep);
&rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -197,12 +191,10 @@ ProcXChangeKeyboardDevice (client) ...@@ -197,12 +191,10 @@ ProcXChangeKeyboardDevice (client)
*/ */
void void
SRepXChangeKeyboardDevice (client, size, rep) SRepXChangeKeyboardDevice(ClientPtr client, int size,
ClientPtr client; xChangeKeyboardDeviceReply * rep)
int size; {
xChangeKeyboardDeviceReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,22 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,22 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGKBD_H #ifndef CHGKBD_H
#define CHGKBD_H 1 #define CHGKBD_H 1
int int SProcXChangeKeyboardDevice(ClientPtr /* client */
SProcXChangeKeyboardDevice( );
ClientPtr /* client */
);
int
ProcXChangeKeyboardDevice (
ClientPtr /* client */
);
void
SRepXChangeKeyboardDevice (
ClientPtr /* client */,
int /* size */,
xChangeKeyboardDeviceReply * /* rep */
);
int ProcXChangeKeyboardDevice(ClientPtr /* client */
);
void SRepXChangeKeyboardDevice(ClientPtr /* client */ ,
int /* size */ ,
xChangeKeyboardDeviceReply * /* rep */
);
#endif /* CHGKBD_H */ #endif /* CHGKBD_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
...@@ -75,9 +75,8 @@ SOFTWARE. ...@@ -75,9 +75,8 @@ SOFTWARE.
*/ */
int int
SProcXChangeDeviceKeyMapping(client) SProcXChangeDeviceKeyMapping(register ClientPtr client)
register ClientPtr client; {
{
unsigned int count; unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq); REQUEST(xChangeDeviceKeyMappingReq);
...@@ -86,8 +85,8 @@ SProcXChangeDeviceKeyMapping(client) ...@@ -86,8 +85,8 @@ SProcXChangeDeviceKeyMapping(client)
count = stuff->keyCodes * stuff->keySymsPerKeyCode; count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), count); SwapLongs((CARD32 *) (&stuff[1]), count);
return(ProcXChangeDeviceKeyMapping(client)); return (ProcXChangeDeviceKeyMapping(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -96,10 +95,9 @@ SProcXChangeDeviceKeyMapping(client) ...@@ -96,10 +95,9 @@ SProcXChangeDeviceKeyMapping(client)
*/ */
int int
ProcXChangeDeviceKeyMapping(client) ProcXChangeDeviceKeyMapping(register ClientPtr client)
register ClientPtr client; {
{ int ret;
int ret;
unsigned len; unsigned len;
DeviceIntPtr dev; DeviceIntPtr dev;
unsigned int count; unsigned int count;
...@@ -110,21 +108,19 @@ ProcXChangeDeviceKeyMapping(client) ...@@ -110,21 +108,19 @@ ProcXChangeDeviceKeyMapping(client)
count = stuff->keyCodes * stuff->keySymsPerKeyCode; count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0,
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0, BadDevice);
BadDevice);
return Success; 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, stuff->firstKeyCode, stuff->keyCodes,
(KeySym *)&stuff[1]); stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]);
if (ret != Success) if (ret != Success)
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0, SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, ret);
ret);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGKMAP_H #ifndef CHGKMAP_H
#define CHGKMAP_H 1 #define CHGKMAP_H 1
int int SProcXChangeDeviceKeyMapping(ClientPtr /* client */
SProcXChangeDeviceKeyMapping( );
ClientPtr /* client */
); int ProcXChangeDeviceKeyMapping(ClientPtr /* client */
);
int
ProcXChangeDeviceKeyMapping(
ClientPtr /* client */
);
#endif /* CHGKMAP_H */ #endif /* CHGKMAP_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" #include "windowstr.h"
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
...@@ -77,9 +77,8 @@ SOFTWARE. ...@@ -77,9 +77,8 @@ SOFTWARE.
*/ */
int int
SProcXChangeDeviceDontPropagateList(client) SProcXChangeDeviceDontPropagateList(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xChangeDeviceDontPropagateListReq); REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
...@@ -88,8 +87,8 @@ SProcXChangeDeviceDontPropagateList(client) ...@@ -88,8 +87,8 @@ SProcXChangeDeviceDontPropagateList(client)
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq, REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
stuff->count * sizeof(CARD32)); stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count); SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return(ProcXChangeDeviceDontPropagateList(client)); return (ProcXChangeDeviceDontPropagateList(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -98,51 +97,47 @@ SProcXChangeDeviceDontPropagateList(client) ...@@ -98,51 +97,47 @@ SProcXChangeDeviceDontPropagateList(client)
*/ */
int int
ProcXChangeDeviceDontPropagateList (client) ProcXChangeDeviceDontPropagateList(register ClientPtr client)
register ClientPtr client; {
{ int i;
int i; WindowPtr pWin;
WindowPtr pWin; struct tmask tmp[EMASKSIZE];
struct tmask tmp[EMASKSIZE]; OtherInputMasks *others;
OtherInputMasks *others;
REQUEST(xChangeDeviceDontPropagateListReq); REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (stuff->length !=(sizeof(xChangeDeviceDontPropagateListReq)>>2) + if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) +
stuff->count) stuff->count) {
{ SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
SendErrorToClient (client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadLength);
BadLength);
return Success; return Success;
} }
pWin = (WindowPtr) LookupWindow (stuff->window, client); pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) if (!pWin) {
{
client->errorValue = stuff->window; client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadWindow); BadWindow);
return Success; return Success;
} }
if (stuff->mode != AddToList && stuff->mode != DeleteFromList) if (stuff->mode != AddToList && stuff->mode != DeleteFromList) {
{
client->errorValue = stuff->window; client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadMode); BadMode);
return Success; return Success;
} }
if (CreateMaskFromList (client, (XEventClass *)&stuff[1], if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success) stuff->count, tmp, NULL,
return Success; X_ChangeDeviceDontPropagateList) != Success)
return Success;
others = wOtherInputMasks(pWin); others = wOtherInputMasks(pWin);
if (!others && stuff->mode == DeleteFromList) if (!others && stuff->mode == DeleteFromList)
return Success; return Success;
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++) {
{
if (tmp[i].mask == 0) if (tmp[i].mask == 0)
continue; continue;
...@@ -151,13 +146,13 @@ ProcXChangeDeviceDontPropagateList (client) ...@@ -151,13 +146,13 @@ ProcXChangeDeviceDontPropagateList (client)
else if (others) else if (others)
tmp[i].mask |= others->dontPropagateMask[i]; tmp[i].mask |= others->dontPropagateMask[i];
if (DeviceEventSuppressForWindow (pWin,client,tmp[i].mask,i) != Success) if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
{ Success) {
SendErrorToClient ( client, IReqCode, X_ChangeDeviceDontPropagateList, 0, SendErrorToClient(client, IReqCode,
BadClass); X_ChangeDeviceDontPropagateList, 0, BadClass);
return Success; return Success;
}
} }
}
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPROP_H #ifndef CHGPROP_H
#define CHGPROP_H 1 #define CHGPROP_H 1
int int SProcXChangeDeviceDontPropagateList(ClientPtr /* client */
SProcXChangeDeviceDontPropagateList ( );
ClientPtr /* client */
); int ProcXChangeDeviceDontPropagateList(ClientPtr /* client */
);
int
ProcXChangeDeviceDontPropagateList (
ClientPtr /* client */
);
#endif /* CHGPROP_H */ #endif /* CHGPROP_H */
...@@ -55,17 +55,17 @@ SOFTWARE. ...@@ -55,17 +55,17 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */ #include "scrnintstr.h" /* screen structure */
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "dixevents.h" #include "dixevents.h"
#include "exevents.h" #include "exevents.h"
...@@ -81,14 +81,13 @@ SOFTWARE. ...@@ -81,14 +81,13 @@ SOFTWARE.
*/ */
int int
SProcXChangePointerDevice(client) SProcXChangePointerDevice(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xChangePointerDeviceReq); REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return(ProcXChangePointerDevice(client)); return (ProcXChangePointerDevice(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -97,14 +96,13 @@ SProcXChangePointerDevice(client) ...@@ -97,14 +96,13 @@ SProcXChangePointerDevice(client)
*/ */
int int
ProcXChangePointerDevice (client) ProcXChangePointerDevice(register ClientPtr client)
register ClientPtr client; {
{ DeviceIntPtr xptr = inputInfo.pointer;
DeviceIntPtr xptr = inputInfo.pointer; DeviceIntPtr dev;
DeviceIntPtr dev; ValuatorClassPtr v;
ValuatorClassPtr v; xChangePointerDeviceReply rep;
xChangePointerDeviceReply rep; changeDeviceNotify ev;
changeDeviceNotify ev;
REQUEST(xChangePointerDeviceReq); REQUEST(xChangePointerDeviceReq);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
...@@ -114,75 +112,68 @@ ProcXChangePointerDevice (client) ...@@ -114,75 +112,68 @@ ProcXChangePointerDevice (client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{
rep.status = -1; rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice); BadDevice);
return Success; return Success;
} }
v = dev->valuator; v = dev->valuator;
if (v == NULL || v->numAxes < 2 || if (v == NULL || v->numAxes < 2 ||
stuff->xaxis >= v->numAxes || stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) {
stuff->yaxis >= v->numAxes)
{
rep.status = -1; rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch); SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
return Success; return Success;
} }
if (((dev->grab) && !SameClient(dev->grab, client)) || if (((dev->grab) && !SameClient(dev->grab, client)) ||
((xptr->grab) && !SameClient(xptr->grab, client))) ((xptr->grab) && !SameClient(xptr->grab, client)))
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen && 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.frozen &&
xptr->sync.other && !SameClient(xptr->sync.other, client))) xptr->sync.other && !SameClient(xptr->sync.other, client)))
rep.status = GrabFrozen; rep.status = GrabFrozen;
else else {
{ if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) !=
if (ChangePointerDevice ( Success) {
xptr, dev, stuff->xaxis, stuff->yaxis) != Success) SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
{ BadDevice);
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
return Success; return Success;
} }
if (dev->focus) if (dev->focus)
DeleteFocusClassDeviceStruct(dev); DeleteFocusClassDeviceStruct(dev);
if (!dev->button) if (!dev->button)
InitButtonClassDeviceStruct (dev, 0, NULL); InitButtonClassDeviceStruct(dev, 0, NULL);
if (!dev->ptrfeed) if (!dev->ptrfeed)
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA); InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA);
RegisterOtherDevice (xptr); RegisterOtherDevice(xptr);
RegisterPointerDevice (dev); RegisterPointerDevice(dev);
ev.type = ChangeDeviceNotify; ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid; ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.request = NewPointer; ev.request = NewPointer;
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1); SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
SendMappingNotify (MappingPointer, 0, 0, client); SendMappingNotify(MappingPointer, 0, 0, client);
rep.status = 0; rep.status = 0;
} }
WriteReplyToClient (client, sizeof (xChangePointerDeviceReply), WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep);
&rep);
return Success; return Success;
} }
void void
DeleteFocusClassDeviceStruct(dev) DeleteFocusClassDeviceStruct(DeviceIntPtr dev)
DeviceIntPtr dev; {
{
free(dev->focus->trace); free(dev->focus->trace);
free(dev->focus); free(dev->focus);
dev->focus = NULL; dev->focus = NULL;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -191,23 +182,18 @@ DeleteFocusClassDeviceStruct(dev) ...@@ -191,23 +182,18 @@ DeleteFocusClassDeviceStruct(dev)
*/ */
void void
SendEventToAllWindows (dev, mask, ev, count) SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
DeviceIntPtr dev; {
Mask mask;
xEvent *ev;
int count;
{
int i; int i;
WindowPtr pWin, p1; WindowPtr pWin, p1;
for (i=0; i<screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++) {
{
pWin = screenInfo.screens[i]->root; pWin = screenInfo.screens[i]->root;
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild; p1 = pWin->firstChild;
FindInterestedChildren (dev, p1, mask, ev, count); FindInterestedChildren(dev, p1, mask, ev, count);
}
} }
}
/*********************************************************************** /***********************************************************************
* *
...@@ -217,23 +203,18 @@ SendEventToAllWindows (dev, mask, ev, count) ...@@ -217,23 +203,18 @@ SendEventToAllWindows (dev, mask, ev, count)
*/ */
void void
FindInterestedChildren (dev, p1, mask, ev, count) FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
DeviceIntPtr dev; xEvent * ev, int count)
WindowPtr p1; {
Mask mask;
xEvent *ev;
int count;
{
WindowPtr p2; WindowPtr p2;
while (p1) while (p1) {
{ p2 = p1->firstChild;
p2 = p1->firstChild;
(void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id); (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
FindInterestedChildren (dev, p2, mask, ev, count); FindInterestedChildren(dev, p2, mask, ev, count);
p1 = p1->nextSib; p1 = p1->nextSib;
}
} }
}
/*********************************************************************** /***********************************************************************
* *
...@@ -243,12 +224,10 @@ FindInterestedChildren (dev, p1, mask, ev, count) ...@@ -243,12 +224,10 @@ FindInterestedChildren (dev, p1, mask, ev, count)
*/ */
void void
SRepXChangePointerDevice (client, size, rep) SRepXChangePointerDevice(ClientPtr client, int size,
ClientPtr client; xChangePointerDeviceReply * rep)
int size; {
xChangePointerDeviceReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,43 +30,32 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,43 +30,32 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPTR_H #ifndef CHGPTR_H
#define CHGPTR_H 1 #define CHGPTR_H 1
int int SProcXChangePointerDevice(ClientPtr /* client */
SProcXChangePointerDevice( );
ClientPtr /* client */
); int ProcXChangePointerDevice(ClientPtr /* client */
);
int
ProcXChangePointerDevice ( void DeleteFocusClassDeviceStruct(DeviceIntPtr /* dev */
ClientPtr /* client */ );
);
void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
void Mask /* mask */ ,
DeleteFocusClassDeviceStruct( xEvent * /* ev */ ,
DeviceIntPtr /* dev */ int /* count */
); );
void void FindInterestedChildren( /* FIXME: could be static? */
SendEventToAllWindows ( DeviceIntPtr /* dev */ ,
DeviceIntPtr /* dev */, WindowPtr /* p1 */ ,
Mask /* mask */, Mask /* mask */ ,
xEvent * /* ev */, xEvent * /* ev */ ,
int /* count */ int /* count */
); );
void void SRepXChangePointerDevice(ClientPtr /* client */ ,
FindInterestedChildren ( /* FIXME: could be static? */ int /* size */ ,
DeviceIntPtr /* dev */, xChangePointerDeviceReply * /* rep */
WindowPtr /* p1 */, );
Mask /* mask */,
xEvent * /* ev */,
int /* count */
);
void
SRepXChangePointerDevice (
ClientPtr /* client */,
int /* size */,
xChangePointerDeviceReply * /* rep */
);
#endif /* CHGPTR_H */ #endif /* CHGPTR_H */
...@@ -55,16 +55,16 @@ SOFTWARE. ...@@ -55,16 +55,16 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */ #include "scrnintstr.h" /* screen structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "closedev.h" #include "closedev.h"
...@@ -76,14 +76,13 @@ SOFTWARE. ...@@ -76,14 +76,13 @@ SOFTWARE.
*/ */
int int
SProcXCloseDevice(client) SProcXCloseDevice(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xCloseDeviceReq); REQUEST(xCloseDeviceReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xCloseDeviceReq); REQUEST_SIZE_MATCH(xCloseDeviceReq);
return(ProcXCloseDevice(client)); return (ProcXCloseDevice(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -92,41 +91,38 @@ SProcXCloseDevice(client) ...@@ -92,41 +91,38 @@ SProcXCloseDevice(client)
*/ */
int int
ProcXCloseDevice(client) ProcXCloseDevice(register ClientPtr client)
register ClientPtr client; {
{ int i;
int i; WindowPtr pWin, p1;
WindowPtr pWin, p1; DeviceIntPtr d;
DeviceIntPtr d;
REQUEST(xCloseDeviceReq); REQUEST(xCloseDeviceReq);
REQUEST_SIZE_MATCH(xCloseDeviceReq); REQUEST_SIZE_MATCH(xCloseDeviceReq);
d = LookupDeviceIntRec (stuff->deviceid); d = LookupDeviceIntRec(stuff->deviceid);
if (d == NULL) if (d == NULL) {
{
SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
return Success; return Success;
} }
if (d->grab && SameClient(d->grab, client)) 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 /* Remove event selections from all windows for events from this device
and selected by this client. * and selected by this client.
Delete passive grabs from all windows for this device. */ * Delete passive grabs from all windows for this device. */
for (i=0; i<screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++) {
{
pWin = screenInfo.screens[i]->root; pWin = screenInfo.screens[i]->root;
DeleteDeviceEvents (d, pWin, client); DeleteDeviceEvents(d, pWin, client);
p1 = pWin->firstChild; p1 = pWin->firstChild;
DeleteEventsFromChildren (d, p1, client); DeleteEventsFromChildren(d, p1, client);
} }
CloseInputDevice (d, client); CloseInputDevice(d, client);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -136,21 +132,17 @@ ProcXCloseDevice(client) ...@@ -136,21 +132,17 @@ ProcXCloseDevice(client)
*/ */
void void
DeleteEventsFromChildren(dev, p1, client) DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
DeviceIntPtr dev; {
WindowPtr p1;
ClientPtr client;
{
WindowPtr p2; WindowPtr p2;
while (p1) while (p1) {
{ p2 = p1->firstChild;
p2 = p1->firstChild; DeleteDeviceEvents(dev, p1, client);
DeleteDeviceEvents (dev, p1, client);
DeleteEventsFromChildren(dev, p2, client); DeleteEventsFromChildren(dev, p2, client);
p1 = p1->nextSib; p1 = p1->nextSib;
}
} }
}
/*********************************************************************** /***********************************************************************
* *
...@@ -160,26 +152,21 @@ DeleteEventsFromChildren(dev, p1, client) ...@@ -160,26 +152,21 @@ DeleteEventsFromChildren(dev, p1, client)
*/ */
void void
DeleteDeviceEvents (dev, pWin, client) DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
DeviceIntPtr dev; {
WindowPtr pWin; InputClientsPtr others;
ClientPtr client; OtherInputMasks *pOthers;
{ GrabPtr grab, next;
InputClientsPtr others;
OtherInputMasks *pOthers;
GrabPtr grab, next;
if ((pOthers = wOtherInputMasks(pWin)) != 0) if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others=pOthers->inputClients; others; for (others = pOthers->inputClients; others; others = others->next)
others = others->next) if (SameClient(others, client))
if (SameClient(others,client))
others->mask[dev->id] = NoEventMask; others->mask[dev->id] = NoEventMask;
for (grab = wPassiveGrabs(pWin); grab; grab=next) for (grab = wPassiveGrabs(pWin); grab; grab = next) {
{
next = grab->next; next = grab->next;
if ((grab->device == dev) && if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource))) (client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource (grab->resource, RT_NONE); FreeResource(grab->resource, RT_NONE);
}
} }
}
...@@ -30,28 +30,20 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,28 +30,20 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CLOSEDEV_H #ifndef CLOSEDEV_H
#define CLOSEDEV_H 1 #define CLOSEDEV_H 1
int int SProcXCloseDevice(ClientPtr /* client */
SProcXCloseDevice( );
ClientPtr /* client */
); int ProcXCloseDevice(ClientPtr /* client */
);
int
ProcXCloseDevice( void DeleteEventsFromChildren(DeviceIntPtr /* dev */ ,
ClientPtr /* client */ WindowPtr /* p1 */ ,
); ClientPtr /* client */
);
void
DeleteEventsFromChildren( void DeleteDeviceEvents(DeviceIntPtr /* dev */ ,
DeviceIntPtr /* dev */, WindowPtr /* pWin */ ,
WindowPtr /* p1 */, ClientPtr /* client */
ClientPtr /* client */ );
);
void
DeleteDeviceEvents (
DeviceIntPtr /* dev */,
WindowPtr /* pWin */,
ClientPtr /* client */
);
#endif /* CLOSEDEV_H */ #endif /* CLOSEDEV_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "devbell.h" #include "devbell.h"
...@@ -74,13 +74,12 @@ SOFTWARE. ...@@ -74,13 +74,12 @@ SOFTWARE.
*/ */
int int
SProcXDeviceBell(client) SProcXDeviceBell(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xDeviceBellReq); REQUEST(xDeviceBellReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXDeviceBell(client)); return (ProcXDeviceBell(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -89,9 +88,8 @@ SProcXDeviceBell(client) ...@@ -89,9 +88,8 @@ SProcXDeviceBell(client)
*/ */
int int
ProcXDeviceBell (client) ProcXDeviceBell(register ClientPtr client)
register ClientPtr client; {
{
DeviceIntPtr dev; DeviceIntPtr dev;
KbdFeedbackPtr k; KbdFeedbackPtr k;
BellFeedbackPtr b; BellFeedbackPtr b;
...@@ -104,64 +102,55 @@ ProcXDeviceBell (client) ...@@ -104,64 +102,55 @@ ProcXDeviceBell (client)
REQUEST(xDeviceBellReq); REQUEST(xDeviceBellReq);
REQUEST_SIZE_MATCH(xDeviceBellReq); REQUEST_SIZE_MATCH(xDeviceBellReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{
client->errorValue = stuff->deviceid; client->errorValue = stuff->deviceid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice); SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
return Success; return Success;
} }
if (stuff->percent < -100 || stuff->percent > 100) if (stuff->percent < -100 || stuff->percent > 100) {
{
client->errorValue = stuff->percent; client->errorValue = stuff->percent;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success; return Success;
} }
if (stuff->feedbackclass == KbdFeedbackClass) 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) if (k->ctrl.id == stuff->feedbackid)
break; break;
if (!k) if (!k) {
{
client->errorValue = stuff->feedbackid; client->errorValue = stuff->feedbackid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success; return Success;
} }
base = k->ctrl.bell; base = k->ctrl.bell;
proc = k->BellProc; proc = k->BellProc;
ctrl = (void *) &(k->ctrl); ctrl = (void *) &(k->ctrl);
class = KbdFeedbackClass; class = KbdFeedbackClass;
} } else if (stuff->feedbackclass == BellFeedbackClass) {
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) if (b->ctrl.id == stuff->feedbackid)
break; break;
if (!b) if (!b) {
{
client->errorValue = stuff->feedbackid; client->errorValue = stuff->feedbackid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success; return Success;
} }
base = b->ctrl.percent; base = b->ctrl.percent;
proc = b->BellProc; proc = b->BellProc;
ctrl = (void *) &(b->ctrl); ctrl = (void *) &(b->ctrl);
class = BellFeedbackClass; class = BellFeedbackClass;
} } else {
else
{
client->errorValue = stuff->feedbackclass; client->errorValue = stuff->feedbackclass;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success; return Success;
} }
newpercent = (base * stuff->percent) / 100; newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0) if (stuff->percent < 0)
newpercent = base + newpercent; newpercent = base + newpercent;
else else
newpercent = base - newpercent + stuff->percent; newpercent = base - newpercent + stuff->percent;
(*proc)(newpercent, dev, ctrl, class); (*proc) (newpercent, dev, ctrl, class);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef DEVBELL_H #ifndef DEVBELL_H
#define DEVBELL_H 1 #define DEVBELL_H 1
int int SProcXDeviceBell(ClientPtr /* client */
SProcXDeviceBell ( );
ClientPtr /* client */
); int ProcXDeviceBell(ClientPtr /* client */
);
int
ProcXDeviceBell (
ClientPtr /* client */
);
#endif /* DEVBELL_H */ #endif /* DEVBELL_H */
...@@ -66,10 +66,10 @@ SOFTWARE. ...@@ -66,10 +66,10 @@ SOFTWARE.
#include "region.h" #include "region.h"
#include "exevents.h" #include "exevents.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "dixevents.h" /* DeliverFocusedEvent */ #include "dixevents.h" /* DeliverFocusedEvent */
#include "dixgrabs.h" /* CreateGrab() */ #include "dixgrabs.h" /* CreateGrab() */
#include "chgptr.h" #include "chgptr.h"
...@@ -82,13 +82,11 @@ SOFTWARE. ...@@ -82,13 +82,11 @@ SOFTWARE.
#define Motion_Filter(class) (DevicePointerMotionMask | \ #define Motion_Filter(class) (DevicePointerMotionMask | \
(class)->state | (class)->motionMask) (class)->state | (class)->motionMask)
static Bool ShouldFreeInputMasks( static Bool ShouldFreeInputMasks(WindowPtr /* pWin */ ,
WindowPtr /* pWin */, Bool /* ignoreSelectedEvents */
Bool /* ignoreSelectedEvents */ );
); static Bool MakeInputMasks(WindowPtr /* pWin */
static Bool MakeInputMasks ( );
WindowPtr /* pWin */
);
/************************************************************************** /**************************************************************************
* *
...@@ -97,153 +95,137 @@ static Bool MakeInputMasks ( ...@@ -97,153 +95,137 @@ static Bool MakeInputMasks (
*/ */
void void
RegisterOtherDevice (device) RegisterOtherDevice(DeviceIntPtr device)
DeviceIntPtr device; {
{
device->public.processInputProc = ProcessOtherEvent; device->public.processInputProc = ProcessOtherEvent;
device->public.realInputProc = ProcessOtherEvent; device->public.realInputProc = ProcessOtherEvent;
(device)->ActivateGrab = ActivateKeyboardGrab; (device)->ActivateGrab = ActivateKeyboardGrab;
(device)->DeactivateGrab = DeactivateKeyboardGrab; (device)->DeactivateGrab = DeactivateKeyboardGrab;
} }
/*ARGSUSED*/ /*ARGSUSED*/ void
void ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count)
ProcessOtherEvent (xE, other, count) {
xEventPtr xE; register BYTE *kptr;
register DeviceIntPtr other; register int i;
int count; register CARD16 modifiers;
{ register CARD16 mask;
register BYTE *kptr; GrabPtr grab = other->grab;
register int i; Bool deactivateDeviceGrab = FALSE;
register CARD16 modifiers; int key = 0, bit = 0, rootX, rootY;
register CARD16 mask; ButtonClassPtr b = other->button;
GrabPtr grab = other->grab; KeyClassPtr k = other->key;
Bool deactivateDeviceGrab = FALSE; ValuatorClassPtr v = other->valuator;
int key = 0, bit = 0, rootX, rootY; deviceValuator *xV = (deviceValuator *) xE;
ButtonClassPtr b = other->button;
KeyClassPtr k = other->key;
ValuatorClassPtr v = other->valuator;
deviceValuator *xV = (deviceValuator *) xE;
if (xE->u.u.type != DeviceValuator) { if (xE->u.u.type != DeviceValuator) {
GetSpritePosition(&rootX, &rootY); GetSpritePosition(&rootX, &rootY);
xE->u.keyButtonPointer.rootX = rootX; xE->u.keyButtonPointer.rootX = rootX;
xE->u.keyButtonPointer.rootY = rootY; xE->u.keyButtonPointer.rootY = rootY;
key = xE->u.u.detail; key = xE->u.u.detail;
NoticeEventTime(xE); NoticeEventTime(xE);
xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state | xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
inputInfo.pointer->button->state; inputInfo.pointer->button->state;
bit = 1 << (key & 7); bit = 1 << (key & 7);
} }
if (DeviceEventCallback) if (DeviceEventCallback) {
{
DeviceEventInfoRec eventinfo; DeviceEventInfoRec eventinfo;
eventinfo.events = (xEventPtr) xE; eventinfo.events = (xEventPtr) xE;
eventinfo.count = count; eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); CallCallbacks(&DeviceEventCallback, (void *) & eventinfo);
} }
for (i=1; i<count; i++) for (i = 1; i < count; i++)
if ((++xV)->type == DeviceValuator) if ((++xV)->type == DeviceValuator) {
{
int first = xV->first_valuator; int first = xV->first_valuator;
int *axisvals; int *axisvals;
if (xV->num_valuators && (!v || (xV->num_valuators && (first + xV->num_valuators > v->numAxes)))) if (xV->num_valuators
FatalError("Bad valuators reported for device %s\n",other->name); && (!v
|| (xV->num_valuators
&& (first + xV->num_valuators > v->numAxes))))
FatalError("Bad valuators reported for device %s\n",
other->name);
xV->device_state = 0; xV->device_state = 0;
if (k) if (k)
xV->device_state |= k->state; xV->device_state |= k->state;
if (b) if (b)
xV->device_state |= b->state; xV->device_state |= b->state;
if (v && v->axisVal) if (v && v->axisVal) {
{ axisvals = v->axisVal;
axisvals = v->axisVal; switch (xV->num_valuators) {
switch (xV->num_valuators) { case 6:
case 6: *(axisvals + first + 5) = xV->valuator5;
*(axisvals+first+5) = xV->valuator5; case 5:
case 5: *(axisvals + first + 4) = xV->valuator4;
*(axisvals+first+4) = xV->valuator4; case 4:
case 4: *(axisvals + first + 3) = xV->valuator3;
*(axisvals+first+3) = xV->valuator3; case 3:
case 3: *(axisvals + first + 2) = xV->valuator2;
*(axisvals+first+2) = xV->valuator2; case 2:
case 2: *(axisvals + first + 1) = xV->valuator1;
*(axisvals+first+1) = xV->valuator1; case 1:
case 1: *(axisvals + first) = xV->valuator0;
*(axisvals+first) = xV->valuator0; case 0:
case 0: default:
default: break;
break;
}
} }
} }
}
if (xE->u.u.type == DeviceKeyPress)
{ if (xE->u.u.type == DeviceKeyPress) {
modifiers = k->modifierMap[key]; modifiers = k->modifierMap[key];
kptr = &k->down[key >> 3]; kptr = &k->down[key >> 3];
if (*kptr & bit) /* allow ddx to generate multiple downs */ if (*kptr & bit) { /* allow ddx to generate multiple downs */
{ if (!modifiers) {
if (!modifiers)
{
xE->u.u.type = DeviceKeyRelease; xE->u.u.type = DeviceKeyRelease;
ProcessOtherEvent(xE, other, count); ProcessOtherEvent(xE, other, count);
xE->u.u.type = DeviceKeyPress; 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); ProcessOtherEvent(xE, other, count);
}
return;
} }
return;
}
if (other->valuator) if (other->valuator)
other->valuator->motionHintWindow = NullWindow; other->valuator->motionHintWindow = NullWindow;
*kptr |= bit; *kptr |= bit;
k->prev_state = k->state; k->prev_state = k->state;
for (i = 0, mask = 1; modifiers; i++, mask <<= 1) for (i = 0, mask = 1; modifiers; i++, mask <<= 1) {
{ if (mask & modifiers) {
if (mask & modifiers)
{
/* This key affects modifier "i" */ /* This key affects modifier "i" */
k->modifierKeyCount[i]++; k->modifierKeyCount[i]++;
k->state |= mask; k->state |= mask;
modifiers &= ~mask; modifiers &= ~mask;
}
} }
if (!grab && CheckDeviceGrabs(other, xE, 0, count)) }
{ if (!grab && CheckDeviceGrabs(other, xE, 0, count)) {
other->activatingKey = key; other->activatingKey = key;
return; return;
}
} }
else if (xE->u.u.type == DeviceKeyRelease) } else if (xE->u.u.type == DeviceKeyRelease) {
{ kptr = &k->down[key >> 3];
kptr = &k->down[key >> 3]; if (!(*kptr & bit)) /* guard against duplicates */
if (!(*kptr & bit)) /* guard against duplicates */
return; return;
modifiers = k->modifierMap[key]; modifiers = k->modifierMap[key];
if (other->valuator) if (other->valuator)
other->valuator->motionHintWindow = NullWindow; other->valuator->motionHintWindow = NullWindow;
*kptr &= ~bit; *kptr &= ~bit;
k->prev_state = k->state; k->prev_state = k->state;
for (i = 0, mask = 1; modifiers; i++, mask <<= 1) for (i = 0, mask = 1; modifiers; i++, mask <<= 1) {
{ if (mask & modifiers) {
if (mask & modifiers)
{
/* This key affects modifier "i" */ /* This key affects modifier "i" */
if (--k->modifierKeyCount[i] <= 0) if (--k->modifierKeyCount[i] <= 0) {
{
k->modifierKeyCount[i] = 0; k->modifierKeyCount[i] = 0;
k->state &= ~mask; k->state &= ~mask;
}
modifiers &= ~mask;
} }
modifiers &= ~mask;
} }
}
if (other->fromPassiveGrab && (key == other->activatingKey)) if (other->fromPassiveGrab && (key == other->activatingKey))
deactivateDeviceGrab = TRUE; deactivateDeviceGrab = TRUE;
} } else if (xE->u.u.type == DeviceButtonPress) {
else if (xE->u.u.type == DeviceButtonPress) kptr = &b->down[key >> 3];
{
kptr = &b->down[key >> 3];
*kptr |= bit; *kptr |= bit;
if (other->valuator) if (other->valuator)
other->valuator->motionHintWindow = NullWindow; other->valuator->motionHintWindow = NullWindow;
...@@ -251,33 +233,30 @@ ProcessOtherEvent (xE, other, count) ...@@ -251,33 +233,30 @@ ProcessOtherEvent (xE, other, count)
b->motionMask = DeviceButtonMotionMask; b->motionMask = DeviceButtonMotionMask;
xE->u.u.detail = b->map[key]; xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0) if (xE->u.u.detail == 0)
return; return;
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
b->state |= (Button1Mask >> 1) << xE->u.u.detail; b->state |= (Button1Mask >> 1) << xE->u.u.detail;
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify); SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
if (!grab) if (!grab)
if (CheckDeviceGrabs(other, xE, 0, count)) if (CheckDeviceGrabs(other, xE, 0, count))
return; return;
} } else if (xE->u.u.type == DeviceButtonRelease) {
else if (xE->u.u.type == DeviceButtonRelease) kptr = &b->down[key >> 3];
{
kptr = &b->down[key >> 3];
*kptr &= ~bit; *kptr &= ~bit;
if (other->valuator) if (other->valuator)
other->valuator->motionHintWindow = NullWindow; other->valuator->motionHintWindow = NullWindow;
if (!--b->buttonsDown) if (!--b->buttonsDown)
b->motionMask = 0; b->motionMask = 0;
xE->u.u.detail = b->map[key]; xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0) if (xE->u.u.detail == 0)
return; return;
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
b->state &= ~((Button1Mask >> 1) << xE->u.u.detail); b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify); SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
if (!b->state && other->fromPassiveGrab) if (!b->state && other->fromPassiveGrab)
deactivateDeviceGrab = TRUE; deactivateDeviceGrab = TRUE;
} } else if (xE->u.u.type == ProximityIn)
else if (xE->u.u.type == ProximityIn)
other->valuator->mode &= ~OutOfProximity; other->valuator->mode &= ~OutOfProximity;
else if (xE->u.u.type == ProximityOut) else if (xE->u.u.type == ProximityOut)
other->valuator->mode |= OutOfProximity; other->valuator->mode |= OutOfProximity;
...@@ -291,15 +270,15 @@ ProcessOtherEvent (xE, other, count) ...@@ -291,15 +270,15 @@ ProcessOtherEvent (xE, other, count)
other, count); other, count);
if (deactivateDeviceGrab == TRUE) if (deactivateDeviceGrab == TRUE)
(*other->DeactivateGrab)(other); (*other->DeactivateGrab) (other);
} }
int int
InitProximityClassDeviceStruct( DeviceIntPtr dev) InitProximityClassDeviceStruct(DeviceIntPtr dev)
{ {
register ProximityClassPtr proxc; register ProximityClassPtr proxc;
proxc = (ProximityClassPtr)malloc(sizeof(ProximityClassRec)); proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
if (!proxc) if (!proxc)
return FALSE; return FALSE;
dev->proximity = proxc; dev->proximity = proxc;
...@@ -307,13 +286,8 @@ InitProximityClassDeviceStruct( DeviceIntPtr dev) ...@@ -307,13 +286,8 @@ InitProximityClassDeviceStruct( DeviceIntPtr dev)
} }
void void
InitValuatorAxisStruct( DeviceIntPtr dev, InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int axnum, int resolution, int min_res, int max_res)
int minval,
int maxval,
int resolution,
int min_res,
int max_res )
{ {
register AxisInfoPtr ax = dev->valuator->axes + axnum; register AxisInfoPtr ax = dev->valuator->axes + axnum;
...@@ -325,13 +299,8 @@ InitValuatorAxisStruct( DeviceIntPtr dev, ...@@ -325,13 +299,8 @@ InitValuatorAxisStruct( DeviceIntPtr dev,
} }
static void static void
FixDeviceStateNotify ( FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
DeviceIntPtr dev, ButtonClassPtr b, ValuatorClassPtr v, int first)
deviceStateNotify *ev,
KeyClassPtr k,
ButtonClassPtr b,
ValuatorClassPtr v,
int first)
{ {
ev->type = DeviceStateNotify; ev->type = DeviceStateNotify;
ev->deviceid = dev->id; ev->deviceid = dev->id;
...@@ -344,37 +313,33 @@ FixDeviceStateNotify ( ...@@ -344,37 +313,33 @@ FixDeviceStateNotify (
if (b) { if (b) {
ev->classes_reported |= (1 << ButtonClass); ev->classes_reported |= (1 << ButtonClass);
ev->num_buttons = b->numButtons; 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) {
else if (k) {
ev->classes_reported |= (1 << KeyClass); ev->classes_reported |= (1 << KeyClass);
ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode; 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) { if (v) {
int nval = v->numAxes - first; int nval = v->numAxes - first;
ev->classes_reported |= (1 << ValuatorClass); ev->classes_reported |= (1 << ValuatorClass);
ev->classes_reported |= (dev->valuator->mode << ModeBitsShift); ev->classes_reported |= (dev->valuator->mode << ModeBitsShift);
ev->num_valuators = nval < 3 ? nval : 3; ev->num_valuators = nval < 3 ? nval : 3;
switch (ev->num_valuators) switch (ev->num_valuators) {
{ case 3:
case 3: ev->valuator2 = v->axisVal[first + 2];
ev->valuator2 = v->axisVal[first+2]; case 2:
case 2: ev->valuator1 = v->axisVal[first + 1];
ev->valuator1 = v->axisVal[first+1]; case 1:
case 1: ev->valuator0 = v->axisVal[first];
ev->valuator0 = v->axisVal[first];
break; break;
}
} }
} }
}
static void static void
FixDeviceValuator ( FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
DeviceIntPtr dev, int first)
deviceValuator *ev,
ValuatorClassPtr v,
int first)
{ {
int nval = v->numAxes - first; int nval = v->numAxes - first;
...@@ -383,24 +348,22 @@ FixDeviceValuator ( ...@@ -383,24 +348,22 @@ FixDeviceValuator (
ev->num_valuators = nval < 3 ? nval : 3; ev->num_valuators = nval < 3 ? nval : 3;
ev->first_valuator = first; ev->first_valuator = first;
switch (ev->num_valuators) { switch (ev->num_valuators) {
case 3: case 3:
ev->valuator2 = v->axisVal[first+2]; ev->valuator2 = v->axisVal[first + 2];
case 2: case 2:
ev->valuator1 = v->axisVal[first+1]; ev->valuator1 = v->axisVal[first + 1];
case 1: case 1:
ev->valuator0 = v->axisVal[first]; ev->valuator0 = v->axisVal[first];
break; break;
}
first += ev->num_valuators;
} }
first += ev->num_valuators;
}
void void
DeviceFocusEvent(dev, type, mode, detail, pWin) DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeviceIntPtr dev; register WindowPtr pWin)
int type, mode, detail; {
register WindowPtr pWin; deviceFocus event;
{
deviceFocus event;
if (type == FocusIn) if (type == FocusIn)
type = DeviceFocusIn; type = DeviceFocusIn;
...@@ -414,29 +377,29 @@ DeviceFocusEvent(dev, type, mode, detail, pWin) ...@@ -414,29 +377,29 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
event.window = pWin->drawable.id; event.window = pWin->drawable.id;
event.time = currentTime.milliseconds; event.time = currentTime.milliseconds;
(void) DeliverEventsToWindow(pWin, (xEvent *)&event, 1, (void)DeliverEventsToWindow(pWin, (xEvent *) & event, 1,
DeviceFocusChangeMask, NullGrab, dev->id); DeviceFocusChangeMask, NullGrab, dev->id);
if ((type == DeviceFocusIn) && if ((type == DeviceFocusIn) &&
(wOtherInputMasks(pWin)) && (wOtherInputMasks(pWin)) &&
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask)) (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
{ {
int evcount = 1; int evcount = 1;
deviceStateNotify *ev, *sev; deviceStateNotify *ev, *sev;
deviceKeyStateNotify *kev; deviceKeyStateNotify *kev;
deviceButtonStateNotify *bev; deviceButtonStateNotify *bev;
KeyClassPtr k; KeyClassPtr k;
ButtonClassPtr b; ButtonClassPtr b;
ValuatorClassPtr v; 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; nbuttons = b->numButtons;
if (nbuttons > 32) if (nbuttons > 32)
evcount++; evcount++;
} }
if ((k=dev->key) != NULL) { if ((k = dev->key) != NULL) {
nkeys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode; nkeys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
if (nkeys > 32) if (nkeys > 32)
evcount++; evcount++;
...@@ -444,7 +407,7 @@ DeviceFocusEvent(dev, type, mode, detail, pWin) ...@@ -444,7 +407,7 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
evcount++; evcount++;
} }
} }
if ((v=dev->valuator) != NULL) { if ((v = dev->valuator) != NULL) {
nval = v->numAxes; nval = v->numAxes;
if (nval > 3) if (nval > 3)
...@@ -458,103 +421,89 @@ DeviceFocusEvent(dev, type, mode, detail, pWin) ...@@ -458,103 +421,89 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
} }
sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent)); sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
FixDeviceStateNotify (dev, ev, NULL, NULL, NULL, first); FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
if (b != NULL) { if (b != NULL) {
FixDeviceStateNotify (dev, ev++, NULL, b, v, first); FixDeviceStateNotify(dev, ev++, NULL, b, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
if (nbuttons > 32) { if (nbuttons > 32) {
(ev-1)->deviceid |= MORE_EVENTS; (ev - 1)->deviceid |= MORE_EVENTS;
bev = (deviceButtonStateNotify *) ev++; bev = (deviceButtonStateNotify *) ev++;
bev->type = DeviceButtonStateNotify; bev->type = DeviceButtonStateNotify;
bev->deviceid = dev->id; 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) { if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS; (ev - 1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, (deviceValuator *) ev++, v, first); FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
} }
} }
if (k != NULL) { if (k != NULL) {
FixDeviceStateNotify (dev, ev++, k, NULL, v, first); FixDeviceStateNotify(dev, ev++, k, NULL, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
if (nkeys > 32) { if (nkeys > 32) {
(ev-1)->deviceid |= MORE_EVENTS; (ev - 1)->deviceid |= MORE_EVENTS;
kev = (deviceKeyStateNotify *) ev++; kev = (deviceKeyStateNotify *) ev++;
kev->type = DeviceKeyStateNotify; kev->type = DeviceKeyStateNotify;
kev->deviceid = dev->id; 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) { if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS; (ev - 1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, (deviceValuator *) ev++, v, first); FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
} }
} }
while (nval > 0) { while (nval > 0) {
FixDeviceStateNotify (dev, ev++, NULL, NULL, v, first); FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
if (nval > 0) { if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS; (ev - 1)->deviceid |= MORE_EVENTS;
FixDeviceValuator (dev, (deviceValuator *) ev++, v, first); FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
first += 3; first += 3;
nval -= 3; nval -= 3;
} }
} }
(void) DeliverEventsToWindow(pWin, (xEvent *)sev, evcount, (void)DeliverEventsToWindow(pWin, (xEvent *) sev, evcount,
DeviceStateNotifyMask, NullGrab, dev->id); DeviceStateNotifyMask, NullGrab, dev->id);
free (sev); free(sev);
}
} }
}
int int
GrabButton( GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
ClientPtr client, BYTE other_devices_mode, CARD16 modifiers,
DeviceIntPtr dev, DeviceIntPtr modifier_device, CARD8 button, Window grabWindow,
BYTE this_device_mode, BOOL ownerEvents, Cursor rcursor, Window rconfineTo, Mask eventMask)
BYTE other_devices_mode,
CARD16 modifiers,
DeviceIntPtr modifier_device,
CARD8 button,
Window grabWindow,
BOOL ownerEvents,
Cursor rcursor,
Window rconfineTo,
Mask eventMask)
{ {
WindowPtr pWin, confineTo; WindowPtr pWin, confineTo;
CursorPtr cursor; CursorPtr cursor;
GrabPtr grab; GrabPtr grab;
if ((this_device_mode != GrabModeSync) && if ((this_device_mode != GrabModeSync) &&
(this_device_mode != GrabModeAsync)) (this_device_mode != GrabModeAsync)) {
{
client->errorValue = this_device_mode; client->errorValue = this_device_mode;
return BadValue; return BadValue;
} }
if ((other_devices_mode != GrabModeSync) && if ((other_devices_mode != GrabModeSync) &&
(other_devices_mode != GrabModeAsync)) (other_devices_mode != GrabModeAsync)) {
{
client->errorValue = other_devices_mode; client->errorValue = other_devices_mode;
return BadValue; return BadValue;
} }
if ((modifiers != AnyModifier) && if ((modifiers != AnyModifier) && (modifiers & ~AllModifiersMask)) {
(modifiers & ~AllModifiersMask))
{
client->errorValue = modifiers; client->errorValue = modifiers;
return BadValue; return BadValue;
} }
if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) {
{
client->errorValue = ownerEvents; client->errorValue = ownerEvents;
return BadValue; return BadValue;
} }
...@@ -563,324 +512,266 @@ GrabButton( ...@@ -563,324 +512,266 @@ GrabButton(
return BadWindow; return BadWindow;
if (rconfineTo == None) if (rconfineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else else {
{
confineTo = LookupWindow(rconfineTo, client); confineTo = LookupWindow(rconfineTo, client);
if (!confineTo) if (!confineTo)
return BadWindow; return BadWindow;
} }
if (rcursor == None) if (rcursor == None)
cursor = NullCursor; cursor = NullCursor;
else else {
{ cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR);
cursor = (CursorPtr)LookupIDByType(rcursor, RT_CURSOR); if (!cursor) {
if (!cursor)
{
client->errorValue = rcursor; client->errorValue = rcursor;
return BadCursor; return BadCursor;
} }
} }
grab = CreateGrab(client->index, dev, pWin, eventMask, grab = CreateGrab(client->index, dev, pWin, eventMask,
(Bool)ownerEvents, (Bool) this_device_mode, (Bool)other_devices_mode, (Bool) ownerEvents, (Bool) this_device_mode,
modifier_device, modifiers, DeviceButtonPress, button, confineTo, (Bool) other_devices_mode, modifier_device, modifiers,
cursor); DeviceButtonPress, button, confineTo, cursor);
if (!grab) if (!grab)
return BadAlloc; return BadAlloc;
return AddPassiveGrabToList(grab); return AddPassiveGrabToList(grab);
} }
int int
GrabKey( GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
ClientPtr client, BYTE other_devices_mode, CARD16 modifiers,
DeviceIntPtr dev, DeviceIntPtr modifier_device, CARD8 key, Window grabWindow,
BYTE this_device_mode, BOOL ownerEvents, Mask mask)
BYTE other_devices_mode,
CARD16 modifiers,
DeviceIntPtr modifier_device,
CARD8 key,
Window grabWindow,
BOOL ownerEvents,
Mask mask)
{ {
WindowPtr pWin; WindowPtr pWin;
GrabPtr grab; GrabPtr grab;
KeyClassPtr k = dev->key; KeyClassPtr k = dev->key;
if (k==NULL) if (k == NULL)
return BadMatch; return BadMatch;
if ((other_devices_mode != GrabModeSync) && if ((other_devices_mode != GrabModeSync) &&
(other_devices_mode != GrabModeAsync)) (other_devices_mode != GrabModeAsync)) {
{
client->errorValue = other_devices_mode; client->errorValue = other_devices_mode;
return BadValue; return BadValue;
} }
if ((this_device_mode != GrabModeSync) && if ((this_device_mode != GrabModeSync) &&
(this_device_mode != GrabModeAsync)) (this_device_mode != GrabModeAsync)) {
{
client->errorValue = this_device_mode; client->errorValue = this_device_mode;
return BadValue; return BadValue;
} }
if (((key > k->curKeySyms.maxKeyCode) || if (((key > k->curKeySyms.maxKeyCode) || (key < k->curKeySyms.minKeyCode))
(key < k->curKeySyms.minKeyCode)) && (key != AnyKey)) {
&& (key != AnyKey))
{
client->errorValue = key; client->errorValue = key;
return BadValue; return BadValue;
} }
if ((modifiers != AnyModifier) && if ((modifiers != AnyModifier) && (modifiers & ~AllModifiersMask)) {
(modifiers & ~AllModifiersMask))
{
client->errorValue = modifiers; client->errorValue = modifiers;
return BadValue; return BadValue;
} }
if ((ownerEvents != xTrue) && (ownerEvents != xFalse)) if ((ownerEvents != xTrue) && (ownerEvents != xFalse)) {
{
client->errorValue = ownerEvents; client->errorValue = ownerEvents;
return BadValue; return BadValue;
} }
pWin = LookupWindow(grabWindow, client); pWin = LookupWindow(grabWindow, client);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
grab = CreateGrab(client->index, dev, pWin, grab = CreateGrab(client->index, dev, pWin,
mask, ownerEvents, this_device_mode, other_devices_mode, mask, ownerEvents, this_device_mode, other_devices_mode,
modifier_device, modifiers, DeviceKeyPress, key, NullWindow, modifier_device, modifiers, DeviceKeyPress, key,
NullCursor); NullWindow, NullCursor);
if (!grab) if (!grab)
return BadAlloc; return BadAlloc;
return AddPassiveGrabToList(grab); return AddPassiveGrabToList(grab);
} }
int int
SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks) SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
DeviceIntPtr dev; Mask mask, Mask exclusivemasks, Mask validmasks)
WindowPtr pWin;
ClientPtr client;
Mask mask;
Mask exclusivemasks;
Mask validmasks;
{ {
int mskidx = dev->id; int mskidx = dev->id;
int i, ret; int i, ret;
Mask check; Mask check;
InputClientsPtr others; InputClientsPtr others;
if (mask & ~validmasks) if (mask & ~validmasks) {
{
client->errorValue = mask; client->errorValue = mask;
return BadValue; return BadValue;
} }
check = (mask & exclusivemasks); check = (mask & exclusivemasks);
if (wOtherInputMasks(pWin)) if (wOtherInputMasks(pWin)) {
{ if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different
if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) * clients to select on any of the
{ /* It is illegal for two different * events for maskcheck. However,
clients to select on any of the * it is OK, for some client to
events for maskcheck. However, * continue selecting on one of those
it is OK, for some client to * events. */
continue selecting on one of those for (others = wOtherInputMasks(pWin)->inputClients; others;
events. */ others = others->next) {
for (others = wOtherInputMasks(pWin)->inputClients; others; if (!SameClient(others, client) && (check &
others = others->next) others->mask[mskidx]))
{
if (!SameClient(others, client) && (check &
others->mask[mskidx]))
return BadAccess; return BadAccess;
} }
} }
for (others = wOtherInputMasks(pWin)->inputClients; others; for (others = wOtherInputMasks(pWin)->inputClients; others;
others = others->next) others = others->next) {
{ if (SameClient(others, client)) {
if (SameClient(others, client))
{
check = others->mask[mskidx]; check = others->mask[mskidx];
others->mask[mskidx] = mask; others->mask[mskidx] = mask;
if (mask == 0) if (mask == 0) {
{ for (i = 0; i < EMASKSIZE; i++)
for (i=0; i<EMASKSIZE; i++)
if (i != mskidx && others->mask[i] != 0) if (i != mskidx && others->mask[i] != 0)
break; break;
if (i == EMASKSIZE) if (i == EMASKSIZE) {
{
RecalculateDeviceDeliverableEvents(pWin); RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE)) if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(others->resource, RT_NONE); FreeResource(others->resource, RT_NONE);
return Success; return Success;
}
} }
}
goto maskSet; goto maskSet;
}
} }
} }
}
check = 0; check = 0;
if ((ret = AddExtensionClient (pWin, client, mask, mskidx)) != Success) if ((ret = AddExtensionClient(pWin, client, mask, mskidx)) != Success)
return ret; return ret;
maskSet: maskSet:
if (dev->valuator) if (dev->valuator)
if ((dev->valuator->motionHintWindow == pWin) && if ((dev->valuator->motionHintWindow == pWin) &&
(mask & DevicePointerMotionHintMask) && (mask & DevicePointerMotionHintMask) &&
!(check & DevicePointerMotionHintMask) && !(check & DevicePointerMotionHintMask) && !dev->grab)
!dev->grab)
dev->valuator->motionHintWindow = NullWindow; dev->valuator->motionHintWindow = NullWindow;
RecalculateDeviceDeliverableEvents(pWin); RecalculateDeviceDeliverableEvents(pWin);
return Success; return Success;
} }
int int
AddExtensionClient (pWin, client, mask, mskidx) AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
WindowPtr pWin; {
ClientPtr client;
Mask mask;
int mskidx;
{
InputClientsPtr others; InputClientsPtr others;
if (!pWin->optional && !MakeWindowOptional (pWin)) if (!pWin->optional && !MakeWindowOptional(pWin))
return BadAlloc; return BadAlloc;
others = (InputClients *) malloc(sizeof(InputClients)); others = (InputClients *) malloc(sizeof(InputClients));
if (!others) if (!others)
return BadAlloc; return BadAlloc;
if (!pWin->optional->inputMasks && !MakeInputMasks (pWin)) if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
return BadAlloc; return BadAlloc;
bzero((char *) &others->mask[0], sizeof(Mask)*EMASKSIZE); bzero((char *)&others->mask[0], sizeof(Mask) * EMASKSIZE);
others->mask[mskidx] = mask; others->mask[mskidx] = mask;
others->resource = FakeClientID(client->index); others->resource = FakeClientID(client->index);
others->next = pWin->optional->inputMasks->inputClients; others->next = pWin->optional->inputMasks->inputClients;
pWin->optional->inputMasks->inputClients = others; pWin->optional->inputMasks->inputClients = others;
if (!AddResource(others->resource, RT_INPUTCLIENT, (void *)pWin)) if (!AddResource(others->resource, RT_INPUTCLIENT, (void *) pWin))
return BadAlloc; return BadAlloc;
return Success; return Success;
} }
static Bool static Bool
MakeInputMasks (pWin) MakeInputMasks(WindowPtr pWin)
WindowPtr pWin; {
{
struct _OtherInputMasks *imasks; struct _OtherInputMasks *imasks;
imasks = (struct _OtherInputMasks *) imasks = (struct _OtherInputMasks *)
malloc (sizeof (struct _OtherInputMasks)); malloc(sizeof(struct _OtherInputMasks));
if (!imasks) if (!imasks)
return FALSE; return FALSE;
bzero((char *) imasks, sizeof (struct _OtherInputMasks)); bzero((char *)imasks, sizeof(struct _OtherInputMasks));
pWin->optional->inputMasks = imasks; pWin->optional->inputMasks = imasks;
return TRUE; return TRUE;
} }
void void
RecalculateDeviceDeliverableEvents(pWin) RecalculateDeviceDeliverableEvents(WindowPtr pWin)
WindowPtr pWin; {
{
register InputClientsPtr others; register InputClientsPtr others;
struct _OtherInputMasks *inputMasks; /* default: NULL */ struct _OtherInputMasks *inputMasks; /* default: NULL */
register WindowPtr pChild, tmp; register WindowPtr pChild, tmp;
int i; int i;
pChild = pWin; pChild = pWin;
while (1) while (1) {
{ if ((inputMasks = wOtherInputMasks(pChild)) != 0) {
if ((inputMasks = wOtherInputMasks(pChild)) != 0) for (others = inputMasks->inputClients; others;
{ others = others->next) {
for (others = inputMasks->inputClients; others; for (i = 0; i < EMASKSIZE; i++)
others = others->next)
{
for (i=0; i<EMASKSIZE; i++)
inputMasks->inputEvents[i] |= others->mask[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]; 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)) if (wOtherInputMasks(tmp))
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++)
inputMasks->deliverableEvents[i] |= inputMasks->deliverableEvents[i] |=
(wOtherInputMasks(tmp)->deliverableEvents[i] (wOtherInputMasks(tmp)->deliverableEvents[i]
& ~inputMasks->dontPropagateMask[i] & PropagateMask[i]); & ~inputMasks->
} dontPropagateMask[i] & PropagateMask[i]);
if (pChild->firstChild) }
{ if (pChild->firstChild) {
pChild = pChild->firstChild; pChild = pChild->firstChild;
continue; continue;
} }
while (!pChild->nextSib && (pChild != pWin)) while (!pChild->nextSib && (pChild != pWin))
pChild = pChild->parent; pChild = pChild->parent;
if (pChild == pWin) if (pChild == pWin)
break; break;
pChild = pChild->nextSib; pChild = pChild->nextSib;
}
} }
}
int int
InputClientGone(pWin, id) InputClientGone(register WindowPtr pWin, XID id)
register WindowPtr pWin; {
XID id;
{
register InputClientsPtr other, prev; register InputClientsPtr other, prev;
if (!wOtherInputMasks(pWin)) if (!wOtherInputMasks(pWin))
return(Success); return (Success);
prev = 0; prev = 0;
for (other = wOtherInputMasks(pWin)->inputClients; other; for (other = wOtherInputMasks(pWin)->inputClients; other;
other = other->next) other = other->next) {
{ if (other->resource == id) {
if (other->resource == id) if (prev) {
{
if (prev)
{
prev->next = other->next; prev->next = other->next;
free(other); free(other);
} } else if (!(other->next)) {
else if (!(other->next)) if (ShouldFreeInputMasks(pWin, TRUE)) {
{
if (ShouldFreeInputMasks(pWin, TRUE))
{
wOtherInputMasks(pWin)->inputClients = other->next; wOtherInputMasks(pWin)->inputClients = other->next;
free(wOtherInputMasks(pWin)); free(wOtherInputMasks(pWin));
pWin->optional->inputMasks = (OtherInputMasks *) NULL; pWin->optional->inputMasks = (OtherInputMasks *) NULL;
CheckWindowOptionalNeed (pWin); CheckWindowOptionalNeed(pWin);
free(other); free(other);
} } else {
else
{
other->resource = FakeClientID(0); other->resource = FakeClientID(0);
if (!AddResource(other->resource, RT_INPUTCLIENT, if (!AddResource(other->resource, RT_INPUTCLIENT,
(void *)pWin)) (void *) pWin))
return BadAlloc; return BadAlloc;
}
} }
else } else {
{
wOtherInputMasks(pWin)->inputClients = other->next; wOtherInputMasks(pWin)->inputClients = other->next;
free(other); free(other);
}
RecalculateDeviceDeliverableEvents(pWin);
return(Success);
} }
RecalculateDeviceDeliverableEvents(pWin);
return (Success);
}
prev = other; prev = other;
} }
FatalError("client not on device event list"); FatalError("client not on device event list");
/*NOTREACHED*/ /*NOTREACHED*/
} }
int int
SendEvent (client, d, dest, propagate, ev, mask, count) SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
ClientPtr client; xEvent * ev, Mask mask, int count)
DeviceIntPtr d; {
Window dest;
Bool propagate;
xEvent *ev;
Mask mask;
int count;
{
WindowPtr pWin; WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr spriteWin=GetSpriteWindow(); WindowPtr spriteWin = GetSpriteWindow();
if (dest == PointerWindow) if (dest == PointerWindow)
pWin = spriteWin; pWin = spriteWin;
else if (dest == InputFocus) else if (dest == InputFocus) {
{
WindowPtr inputFocus; WindowPtr inputFocus;
if (!d->focus) if (!d->focus)
inputFocus = spriteWin; inputFocus = spriteWin;
else else
...@@ -893,33 +784,27 @@ SendEvent (client, d, dest, propagate, ev, mask, count) ...@@ -893,33 +784,27 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
return Success; return Success;
/* If the input focus is PointerRootWin, send the event to where /* If the input focus is PointerRootWin, send the event to where
the pointer is if possible, then perhaps propogate up to root. */ * the pointer is if possible, then perhaps propogate up to root. */
if (inputFocus == PointerRootWin) if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(); inputFocus = GetCurrentRootWindow();
if (IsParent(inputFocus, spriteWin)) if (IsParent(inputFocus, spriteWin)) {
{
effectiveFocus = inputFocus; effectiveFocus = inputFocus;
pWin = spriteWin; pWin = spriteWin;
} } else
else
effectiveFocus = pWin = inputFocus; effectiveFocus = pWin = inputFocus;
} } else
else
pWin = LookupWindow(dest, client); pWin = LookupWindow(dest, client);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
if ((propagate != xFalse) && (propagate != xTrue)) if ((propagate != xFalse) && (propagate != xTrue)) {
{
client->errorValue = propagate; client->errorValue = propagate;
return BadValue; return BadValue;
} }
ev->u.u.type |= 0x80; ev->u.u.type |= 0x80;
if (propagate) if (propagate) {
{ for (; pWin; pWin = pWin->parent) {
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; return Success;
if (pWin == effectiveFocus) if (pWin == effectiveFocus)
return Success; return Success;
...@@ -928,158 +813,140 @@ SendEvent (client, d, dest, propagate, ev, mask, count) ...@@ -928,158 +813,140 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
if (!mask) if (!mask)
break; break;
} }
} } else
else (void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id));
(void)(DeliverEventsToWindow( pWin, ev, count, mask, NullGrab, d->id));
return Success; return Success;
} }
int int
SetButtonMapping (client, dev, nElts, map) SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
ClientPtr client; {
DeviceIntPtr dev;
int nElts;
BYTE *map;
{
register int i; register int i;
ButtonClassPtr b = dev->button; ButtonClassPtr b = dev->button;
if (b == NULL) if (b == NULL)
return BadMatch; return BadMatch;
if (nElts != b->numButtons) if (nElts != b->numButtons) {
{
client->errorValue = nElts; client->errorValue = nElts;
return BadValue; return BadValue;
} }
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue)) if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
return BadValue; return BadValue;
for (i=0; i < nElts; i++) for (i = 0; i < nElts; i++)
if ((b->map[i + 1] != map[i]) && if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
BitIsOn(b->down, i + 1)) return MappingBusy;
return MappingBusy;
for (i = 0; i < nElts; i++) for (i = 0; i < nElts; i++)
b->map[i + 1] = map[i]; b->map[i + 1] = map[i];
return Success; return Success;
} }
int int
SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k) SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen,
ClientPtr client; int numKeyPerModifier, KeyCode * inputMap, KeyClassPtr * k)
DeviceIntPtr dev;
int len;
int rlen;
int numKeyPerModifier;
KeyCode *inputMap;
KeyClassPtr *k;
{ {
KeyCode *map = NULL; KeyCode *map = NULL;
int inputMapLen; int inputMapLen;
register int i; register int i;
*k = dev->key; *k = dev->key;
if (*k == NULL) if (*k == NULL)
return BadMatch; return BadMatch;
if (len != ((numKeyPerModifier<<1) + rlen)) if (len != ((numKeyPerModifier << 1) + rlen))
return BadLength; return BadLength;
inputMapLen = 8*numKeyPerModifier; inputMapLen = 8 * numKeyPerModifier;
/* /*
* Now enforce the restriction that "all of the non-zero keycodes must be * 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 * in the range specified by min-keycode and max-keycode in the
* connection setup (else a Value error)" * connection setup (else a Value error)"
*/ */
i = inputMapLen; i = inputMapLen;
while (i--) { while (i--) {
if (inputMap[i] if (inputMap[i]
&& (inputMap[i] < (*k)->curKeySyms.minKeyCode && (inputMap[i] < (*k)->curKeySyms.minKeyCode
|| inputMap[i] > (*k)->curKeySyms.maxKeyCode)) { || inputMap[i] > (*k)->curKeySyms.maxKeyCode)) {
client->errorValue = inputMap[i]; client->errorValue = inputMap[i];
return -1; /* BadValue collides with MappingFailed */ return -1; /* BadValue collides with MappingFailed */
} }
} }
/* /*
* Now enforce the restriction that none of the old or new * Now enforce the restriction that none of the old or new
* modifier keys may be down while we change the mapping, and * modifier keys may be down while we change the mapping, and
* that the DDX layer likes the choice. * that the DDX layer likes the choice.
*/ */
if (!AllModifierKeysAreUp (dev, (*k)->modifierKeyMap, if (!AllModifierKeysAreUp(dev, (*k)->modifierKeyMap,
(int)(*k)->maxKeysPerModifier, inputMap, (int)numKeyPerModifier) (int)(*k)->maxKeysPerModifier, inputMap,
|| (int)numKeyPerModifier)
!AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier, || !AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier,
(*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier)) { (*k)->modifierKeyMap,
(int)(*k)->maxKeysPerModifier)) {
return MappingBusy; return MappingBusy;
} else { } else {
for (i = 0; i < inputMapLen; i++) { for (i = 0; i < inputMapLen; i++) {
if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)dev)) { if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr) dev)) {
return MappingFailed; return MappingFailed;
} }
} }
} }
/* /*
* Now build the keyboard's modifier bitmap from the * Now build the keyboard's modifier bitmap from the
* list of keycodes. * list of keycodes.
*/ */
if (inputMapLen) { if (inputMapLen) {
map = (KeyCode *)malloc(inputMapLen); map = (KeyCode *) malloc(inputMapLen);
if (!map) if (!map)
return BadAlloc; return BadAlloc;
} }
if ((*k)->modifierKeyMap) if ((*k)->modifierKeyMap)
free((*k)->modifierKeyMap); free((*k)->modifierKeyMap);
if (inputMapLen) { if (inputMapLen) {
(*k)->modifierKeyMap = map; (*k)->modifierKeyMap = map;
memmove((char *)(*k)->modifierKeyMap, (char *)inputMap, inputMapLen); memmove((char *)(*k)->modifierKeyMap, (char *)inputMap, inputMapLen);
} else } else
(*k)->modifierKeyMap = NULL; (*k)->modifierKeyMap = NULL;
(*k)->maxKeysPerModifier = numKeyPerModifier; (*k)->maxKeysPerModifier = numKeyPerModifier;
for (i = 0; i < MAP_LENGTH; i++) for (i = 0; i < MAP_LENGTH; i++)
(*k)->modifierMap[i] = 0; (*k)->modifierMap[i] = 0;
for (i = 0; i < inputMapLen; i++) if (inputMap[i]) { for (i = 0; i < inputMapLen; i++)
(*k)->modifierMap[inputMap[i]] if (inputMap[i]) {
|= (1<<(i/ (*k)->maxKeysPerModifier)); (*k)->modifierMap[inputMap[i]]
} |= (1 << (i / (*k)->maxKeysPerModifier));
}
return(MappingSuccess); return (MappingSuccess);
} }
void void
SendDeviceMappingNotify( SendDeviceMappingNotify(CARD8 request,
CARD8 request, KeyCode firstKeyCode, CARD8 count, DeviceIntPtr dev)
KeyCode firstKeyCode,
CARD8 count,
DeviceIntPtr dev)
{ {
xEvent event; xEvent event;
deviceMappingNotify *ev = (deviceMappingNotify *) &event; deviceMappingNotify *ev = (deviceMappingNotify *) & event;
ev->type = DeviceMappingNotify; ev->type = DeviceMappingNotify;
ev->request = request; ev->request = request;
ev->deviceid = dev->id; ev->deviceid = dev->id;
ev->time = currentTime.milliseconds; ev->time = currentTime.milliseconds;
if (request == MappingKeyboard) if (request == MappingKeyboard) {
{
ev->firstKeyCode = firstKeyCode; ev->firstKeyCode = firstKeyCode;
ev->count = count; ev->count = count;
}
SendEventToAllWindows (dev, DeviceMappingNotifyMask, (xEvent *)ev, 1);
} }
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1);
}
int int
ChangeKeyMapping( ChangeKeyMapping(ClientPtr client,
ClientPtr client, DeviceIntPtr dev,
DeviceIntPtr dev, unsigned len,
unsigned len, int type,
int type, KeyCode firstKeyCode,
KeyCode firstKeyCode, CARD8 keyCodes, CARD8 keySymsPerKeyCode, KeySym * map)
CARD8 keyCodes,
CARD8 keySymsPerKeyCode,
KeySym *map)
{ {
KeySymsRec keysyms; KeySymsRec keysyms;
KeyClassPtr k = dev->key; KeyClassPtr k = dev->key;
...@@ -1088,18 +955,16 @@ ChangeKeyMapping( ...@@ -1088,18 +955,16 @@ ChangeKeyMapping(
return (BadMatch); return (BadMatch);
if (len != (keyCodes * keySymsPerKeyCode)) if (len != (keyCodes * keySymsPerKeyCode))
return BadLength; return BadLength;
if ((firstKeyCode < k->curKeySyms.minKeyCode) || if ((firstKeyCode < k->curKeySyms.minKeyCode) ||
(firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode)) (firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode)) {
{ client->errorValue = firstKeyCode;
client->errorValue = firstKeyCode; return BadValue;
return BadValue;
} }
if (keySymsPerKeyCode == 0) if (keySymsPerKeyCode == 0) {
{ client->errorValue = 0;
client->errorValue = 0; return BadValue;
return BadValue;
} }
keysyms.minKeyCode = firstKeyCode; keysyms.minKeyCode = firstKeyCode;
keysyms.maxKeyCode = firstKeyCode + keyCodes - 1; keysyms.maxKeyCode = firstKeyCode + keyCodes - 1;
...@@ -1107,195 +972,169 @@ ChangeKeyMapping( ...@@ -1107,195 +972,169 @@ ChangeKeyMapping(
keysyms.map = map; keysyms.map = map;
if (!SetKeySymsMap(&k->curKeySyms, &keysyms)) if (!SetKeySymsMap(&k->curKeySyms, &keysyms))
return BadAlloc; return BadAlloc;
SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, dev);
dev);
return client->noClientException; return client->noClientException;
} }
void void
DeleteWindowFromAnyExtEvents(pWin, freeResources) DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
WindowPtr pWin; {
Bool freeResources; int i;
{ DeviceIntPtr dev;
int i; InputClientsPtr ic;
DeviceIntPtr dev;
InputClientsPtr ic;
struct _OtherInputMasks *inputMasks; struct _OtherInputMasks *inputMasks;
for (dev=inputInfo.devices; dev; dev=dev->next) for (dev = inputInfo.devices; dev; dev = dev->next) {
{ if (dev == inputInfo.pointer || dev == inputInfo.keyboard)
if (dev == inputInfo.pointer ||
dev == inputInfo.keyboard)
continue; continue;
DeleteDeviceFromAnyExtEvents(pWin, dev); DeleteDeviceFromAnyExtEvents(pWin, dev);
} }
for (dev=inputInfo.off_devices; dev; dev=dev->next) for (dev = inputInfo.off_devices; dev; dev = dev->next)
DeleteDeviceFromAnyExtEvents(pWin, dev); DeleteDeviceFromAnyExtEvents(pWin, dev);
if (freeResources) if (freeResources)
while ((inputMasks = wOtherInputMasks(pWin)) != 0) while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
{
ic = inputMasks->inputClients; ic = inputMasks->inputClients;
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++)
inputMasks->dontPropagateMask[i] = 0; inputMasks->dontPropagateMask[i] = 0;
FreeResource(ic->resource, RT_NONE); FreeResource(ic->resource, RT_NONE);
} }
} }
void void
DeleteDeviceFromAnyExtEvents(pWin, dev) DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
WindowPtr pWin; {
DeviceIntPtr dev; WindowPtr parent;
{
WindowPtr parent;
/* Deactivate any grabs performed on this window, before making /* Deactivate any grabs performed on this window, before making
any input focus changes. * any input focus changes.
Deactivating a device grab should cause focus events. */ * Deactivating a device grab should cause focus events. */
if (dev->grab && (dev->grab->window == pWin)) 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) /* If the focus window is a root window (ie. has no parent)
then don't delete the focus from it. */ * then don't delete the focus from it. */
if (dev->focus && (pWin==dev->focus->win) && (pWin->parent != NullWindow)) if (dev->focus && (pWin == dev->focus->win) && (pWin->parent != NullWindow)) {
{
int focusEventMode = NotifyNormal; 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) if (dev->grab)
focusEventMode = NotifyWhileGrabbed; focusEventMode = NotifyWhileGrabbed;
switch (dev->focus->revert) switch (dev->focus->revert) {
{ case RevertToNone:
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--;
}
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;
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); DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
dev->focus->win = NoneWin; dev->focus->win = NoneWin;
dev->focus->traceGood = 0; dev->focus->traceGood = 0;
break;
case RevertToParent:
parent = pWin;
do
{
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;
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)
if (dev->valuator->motionHintWindow == pWin) if (dev->valuator->motionHintWindow == pWin)
dev->valuator->motionHintWindow = NullWindow; dev->valuator->motionHintWindow = NullWindow;
} }
int int
MaybeSendDeviceMotionNotifyHint (pEvents, mask) MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask)
deviceKeyButtonPointer *pEvents; {
Mask mask;
{
DeviceIntPtr dev; DeviceIntPtr dev;
dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS); dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS);
if (pEvents->type == DeviceMotionNotify) if (pEvents->type == DeviceMotionNotify) {
{ if (mask & DevicePointerMotionHintMask) {
if (mask & DevicePointerMotionHintMask) if (WID(dev->valuator->motionHintWindow) == pEvents->event) {
{ return 1; /* don't send, but pretend we did */
if (WID(dev->valuator->motionHintWindow) == pEvents->event)
{
return 1; /* don't send, but pretend we did */
}
pEvents->detail = NotifyHint;
} }
else pEvents->detail = NotifyHint;
{ } else {
pEvents->detail = NotifyNormal; pEvents->detail = NotifyNormal;
}
} }
return (0);
} }
return (0);
}
void void
CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask) CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
WindowPtr pWin; deviceKeyButtonPointer * xE, GrabPtr grab,
int type; ClientPtr client, Mask deliveryMask)
deviceKeyButtonPointer *xE; {
GrabPtr grab;
ClientPtr client;
Mask deliveryMask;
{
DeviceIntPtr dev; DeviceIntPtr dev;
dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS); dev = LookupDeviceIntRec(xE->deviceid & DEVICE_BITS);
if (type == DeviceMotionNotify) if (type == DeviceMotionNotify)
dev->valuator->motionHintWindow = pWin; dev->valuator->motionHintWindow = pWin;
else if ((type == DeviceButtonPress) && (!grab) && else if ((type == DeviceButtonPress) && (!grab) &&
(deliveryMask & DeviceButtonGrabMask)) (deliveryMask & DeviceButtonGrabMask)) {
{
GrabRec tempGrab; GrabRec tempGrab;
tempGrab.device = dev; tempGrab.device = dev;
tempGrab.resource = client->clientAsMask; tempGrab.resource = client->clientAsMask;
tempGrab.window = pWin; tempGrab.window = pWin;
tempGrab.ownerEvents = (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE; tempGrab.ownerEvents =
(deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE;
tempGrab.eventMask = deliveryMask; tempGrab.eventMask = deliveryMask;
tempGrab.keyboardMode = GrabModeAsync; tempGrab.keyboardMode = GrabModeAsync;
tempGrab.pointerMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync;
tempGrab.confineTo = NullWindow; tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor; tempGrab.cursor = NullCursor;
(*dev->ActivateGrab)(dev, &tempGrab, currentTime, TRUE); (*dev->ActivateGrab) (dev, &tempGrab, currentTime, TRUE);
}
} }
}
Mask Mask
DeviceEventMaskForClient(dev, pWin, client) DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
DeviceIntPtr dev; {
WindowPtr pWin;
ClientPtr client;
{
register InputClientsPtr other; register InputClientsPtr other;
if (!wOtherInputMasks(pWin)) if (!wOtherInputMasks(pWin))
return 0; return 0;
for (other = wOtherInputMasks(pWin)->inputClients; other; for (other = wOtherInputMasks(pWin)->inputClients; other;
other = other->next) other = other->next) {
{
if (SameClient(other, client)) if (SameClient(other, client))
return other->mask[dev->id]; return other->mask[dev->id];
}
return 0;
} }
return 0;
}
void void
MaybeStopDeviceHint(dev, client) MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client)
register DeviceIntPtr dev;
ClientPtr client;
{ {
WindowPtr pWin; WindowPtr pWin;
GrabPtr grab = dev->grab; GrabPtr grab = dev->grab;
pWin = dev->valuator->motionHintWindow; pWin = dev->valuator->motionHintWindow;
if ((grab && SameClient(grab, client) && if ((grab && SameClient(grab, client) &&
...@@ -1310,54 +1149,45 @@ MaybeStopDeviceHint(dev, client) ...@@ -1310,54 +1149,45 @@ MaybeStopDeviceHint(dev, client)
} }
int int
DeviceEventSuppressForWindow(pWin, client, mask, maskndx) DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
WindowPtr pWin; int maskndx)
ClientPtr client; {
Mask mask; struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
int maskndx;
{
struct _OtherInputMasks *inputMasks = wOtherInputMasks (pWin);
if (mask & ~PropagateMask[maskndx]) if (mask & ~PropagateMask[maskndx]) {
{
client->errorValue = mask; client->errorValue = mask;
return BadValue; return BadValue;
} }
if (mask == 0) if (mask == 0) {
{
if (inputMasks) if (inputMasks)
inputMasks->dontPropagateMask[maskndx] = mask; inputMasks->dontPropagateMask[maskndx] = mask;
} } else {
else
{
if (!inputMasks) if (!inputMasks)
AddExtensionClient (pWin, client, 0, 0); AddExtensionClient(pWin, client, 0, 0);
inputMasks = wOtherInputMasks(pWin); inputMasks = wOtherInputMasks(pWin);
inputMasks->dontPropagateMask[maskndx] = mask; inputMasks->dontPropagateMask[maskndx] = mask;
} }
RecalculateDeviceDeliverableEvents(pWin); RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE)) if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, RT_NONE); FreeResource(inputMasks->inputClients->resource, RT_NONE);
return Success; return Success;
} }
static Bool static Bool
ShouldFreeInputMasks (pWin, ignoreSelectedEvents) ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
WindowPtr pWin; {
Bool ignoreSelectedEvents;
{
int i; int i;
Mask allInputEventMasks = 0; 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]; allInputEventMasks |= inputMasks->dontPropagateMask[i];
if (!ignoreSelectedEvents) if (!ignoreSelectedEvents)
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++)
allInputEventMasks |= inputMasks->inputEvents[i]; allInputEventMasks |= inputMasks->inputEvents[i];
if (allInputEventMasks == 0) if (allInputEventMasks == 0)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
...@@ -35,45 +35,45 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -35,45 +35,45 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef EXGLOBALS_H #ifndef EXGLOBALS_H
#define EXGLOBALS_H 1 #define EXGLOBALS_H 1
extern int IReqCode; extern int IReqCode;
extern int BadDevice; extern int BadDevice;
extern int BadEvent; extern int BadEvent;
extern int BadMode; extern int BadMode;
extern int DeviceBusy; extern int DeviceBusy;
extern int BadClass; extern int BadClass;
extern Mask DevicePointerMotionMask; extern Mask DevicePointerMotionMask;
extern Mask DevicePointerMotionHintMask; extern Mask DevicePointerMotionHintMask;
extern Mask DeviceFocusChangeMask; extern Mask DeviceFocusChangeMask;
extern Mask DeviceStateNotifyMask; extern Mask DeviceStateNotifyMask;
extern Mask ChangeDeviceNotifyMask; extern Mask ChangeDeviceNotifyMask;
extern Mask DeviceMappingNotifyMask; extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask; extern Mask DeviceButtonGrabMask;
extern Mask DeviceButtonMotionMask; extern Mask DeviceButtonMotionMask;
extern Mask PropagateMask[]; extern Mask PropagateMask[];
extern int DeviceValuator; extern int DeviceValuator;
extern int DeviceKeyPress; extern int DeviceKeyPress;
extern int DeviceKeyRelease; extern int DeviceKeyRelease;
extern int DeviceButtonPress; extern int DeviceButtonPress;
extern int DeviceButtonRelease; extern int DeviceButtonRelease;
extern int DeviceMotionNotify; extern int DeviceMotionNotify;
extern int DeviceFocusIn; extern int DeviceFocusIn;
extern int DeviceFocusOut; extern int DeviceFocusOut;
extern int ProximityIn; extern int ProximityIn;
extern int ProximityOut; extern int ProximityOut;
extern int DeviceStateNotify; extern int DeviceStateNotify;
extern int DeviceKeyStateNotify; extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify; extern int DeviceButtonStateNotify;
extern int DeviceMappingNotify; extern int DeviceMappingNotify;
extern int ChangeDeviceNotify; extern int ChangeDeviceNotify;
extern int RT_INPUTCLIENT; extern int RT_INPUTCLIENT;
#if 0 #if 0
/* FIXME: in dix */ /* FIXME: in dix */
extern InputInfo inputInfo; extern InputInfo inputInfo;
#endif #endif
#endif /* EXGLOBALS_H */ #endif /* EXGLOBALS_H */
...@@ -60,8 +60,8 @@ SOFTWARE. ...@@ -60,8 +60,8 @@ SOFTWARE.
#include <nx-X11/X.h> #include <nx-X11/X.h>
#include <nx-X11/Xproto.h> #include <nx-X11/Xproto.h>
#include "inputstr.h" #include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h*/ #include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */ #include "extnsionst.h" /* extension entry */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
...@@ -111,35 +111,37 @@ SOFTWARE. ...@@ -111,35 +111,37 @@ SOFTWARE.
#include "ungrdevb.h" #include "ungrdevb.h"
#include "ungrdevk.h" #include "ungrdevk.h"
static Mask lastExtEventMask = 1; static Mask lastExtEventMask = 1;
int ExtEventIndex; int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE]; Mask ExtValidMasks[EMASKSIZE];
Mask ExtExclusiveMasks[EMASKSIZE]; Mask ExtExclusiveMasks[EMASKSIZE];
struct dev_type struct dev_type
{
Atom type;
char *name;
} dev_type[] = {
{ {
Atom type; 0, XI_KEYBOARD}, {
char *name; 0, XI_MOUSE}, {
}dev_type [] = {{0,XI_KEYBOARD}, 0, XI_TABLET}, {
{0,XI_MOUSE}, 0, XI_TOUCHSCREEN}, {
{0,XI_TABLET}, 0, XI_TOUCHPAD}, {
{0,XI_TOUCHSCREEN}, 0, XI_BARCODE}, {
{0,XI_TOUCHPAD}, 0, XI_BUTTONBOX}, {
{0,XI_BARCODE}, 0, XI_KNOB_BOX}, {
{0,XI_BUTTONBOX}, 0, XI_ONE_KNOB}, {
{0,XI_KNOB_BOX}, 0, XI_NINE_KNOB}, {
{0,XI_ONE_KNOB}, 0, XI_TRACKBALL}, {
{0,XI_NINE_KNOB}, 0, XI_QUADRATURE}, {
{0,XI_TRACKBALL}, 0, XI_ID_MODULE}, {
{0,XI_QUADRATURE}, 0, XI_SPACEBALL}, {
{0,XI_ID_MODULE}, 0, XI_DATAGLOVE}, {
{0,XI_SPACEBALL}, 0, XI_EYETRACKER}, {
{0,XI_DATAGLOVE}, 0, XI_CURSORKEYS}, {
{0,XI_EYETRACKER}, 0, XI_FOOTMOUSE}};
{0,XI_CURSORKEYS},
{0,XI_FOOTMOUSE}}; CARD8 event_base[numInputClasses];
CARD8 event_base [numInputClasses];
XExtEventInfo EventInfo[32]; XExtEventInfo EventInfo[32];
/***************************************************************** /*****************************************************************
...@@ -148,40 +150,40 @@ XExtEventInfo EventInfo[32]; ...@@ -148,40 +150,40 @@ XExtEventInfo EventInfo[32];
* *
*/ */
int IReqCode = 0; int IReqCode = 0;
int BadDevice = 0; int BadDevice = 0;
int BadEvent = 1; int BadEvent = 1;
int BadMode = 2; int BadMode = 2;
int DeviceBusy = 3; int DeviceBusy = 3;
int BadClass = 4; int BadClass = 4;
Mask DevicePointerMotionMask; Mask DevicePointerMotionMask;
Mask DevicePointerMotionHintMask; Mask DevicePointerMotionHintMask;
Mask DeviceFocusChangeMask; Mask DeviceFocusChangeMask;
Mask DeviceStateNotifyMask; Mask DeviceStateNotifyMask;
Mask ChangeDeviceNotifyMask; Mask ChangeDeviceNotifyMask;
Mask DeviceMappingNotifyMask; Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask; Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask; Mask DeviceButtonGrabMask;
Mask DeviceButtonMotionMask; Mask DeviceButtonMotionMask;
int DeviceValuator; int DeviceValuator;
int DeviceKeyPress; int DeviceKeyPress;
int DeviceKeyRelease; int DeviceKeyRelease;
int DeviceButtonPress; int DeviceButtonPress;
int DeviceButtonRelease; int DeviceButtonRelease;
int DeviceMotionNotify; int DeviceMotionNotify;
int DeviceFocusIn; int DeviceFocusIn;
int DeviceFocusOut; int DeviceFocusOut;
int ProximityIn; int ProximityIn;
int ProximityOut; int ProximityOut;
int DeviceStateNotify; int DeviceStateNotify;
int DeviceKeyStateNotify; int DeviceKeyStateNotify;
int DeviceButtonStateNotify; int DeviceButtonStateNotify;
int DeviceMappingNotify; int DeviceMappingNotify;
int ChangeDeviceNotify; int ChangeDeviceNotify;
int RT_INPUTCLIENT; int RT_INPUTCLIENT;
/***************************************************************** /*****************************************************************
* *
...@@ -189,9 +191,9 @@ int RT_INPUTCLIENT; ...@@ -189,9 +191,9 @@ int RT_INPUTCLIENT;
* *
*/ */
extern XExtensionVersion AllExtensionVersions[]; extern XExtensionVersion AllExtensionVersions[];
Mask PropagateMask[MAX_DEVICES]; Mask PropagateMask[MAX_DEVICES];
/***************************************************************** /*****************************************************************
* *
...@@ -203,7 +205,7 @@ static XExtensionVersion thisversion = ...@@ -203,7 +205,7 @@ static XExtensionVersion thisversion =
{XI_Present, {XI_Present,
SERVER_XI_MAJOR_VERSION, SERVER_XI_MAJOR_VERSION,
SERVER_XI_MINOR_VERSION, SERVER_XI_MINOR_VERSION,
}; };
/********************************************************************** /**********************************************************************
* *
...@@ -217,20 +219,19 @@ static XExtensionVersion thisversion = ...@@ -217,20 +219,19 @@ static XExtensionVersion thisversion =
*/ */
void void
XInputExtensionInit() XInputExtensionInit(void)
{ {
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode); SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) if (extEntry) {
{
IReqCode = extEntry->base; IReqCode = extEntry->base;
AllExtensionVersions[IReqCode-128] = thisversion; AllExtensionVersions[IReqCode - 128] = thisversion;
MakeDeviceTypeAtoms (); MakeDeviceTypeAtoms();
RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone); RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
FixExtensionEvents (extEntry); FixExtensionEvents(extEntry);
ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch; ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch; EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch; EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch; EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
...@@ -246,12 +247,10 @@ XInputExtensionInit() ...@@ -246,12 +247,10 @@ XInputExtensionInit()
EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
EventSwapVector[DeviceMappingNotify] = SEventIDispatch; EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
} } else {
else
{
FatalError("IExtensionInit: AddExtensions failed\n"); FatalError("IExtensionInit: AddExtensions failed\n");
}
} }
}
/************************************************************************* /*************************************************************************
* *
...@@ -261,86 +260,84 @@ XInputExtensionInit() ...@@ -261,86 +260,84 @@ XInputExtensionInit()
*/ */
int int
ProcIDispatch (client) ProcIDispatch(register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xReq); REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion) if (stuff->data == X_GetExtensionVersion)
return(ProcXGetExtensionVersion(client)); return (ProcXGetExtensionVersion(client));
if (stuff->data == X_ListInputDevices) if (stuff->data == X_ListInputDevices)
return(ProcXListInputDevices(client)); return (ProcXListInputDevices(client));
else if (stuff->data == X_OpenDevice) else if (stuff->data == X_OpenDevice)
return(ProcXOpenDevice(client)); return (ProcXOpenDevice(client));
else if (stuff->data == X_CloseDevice) else if (stuff->data == X_CloseDevice)
return(ProcXCloseDevice(client)); return (ProcXCloseDevice(client));
else if (stuff->data == X_SetDeviceMode) else if (stuff->data == X_SetDeviceMode)
return(ProcXSetDeviceMode(client)); return (ProcXSetDeviceMode(client));
else if (stuff->data == X_SelectExtensionEvent) else if (stuff->data == X_SelectExtensionEvent)
return(ProcXSelectExtensionEvent(client)); return (ProcXSelectExtensionEvent(client));
else if (stuff->data == X_GetSelectedExtensionEvents) else if (stuff->data == X_GetSelectedExtensionEvents)
return(ProcXGetSelectedExtensionEvents(client)); return (ProcXGetSelectedExtensionEvents(client));
else if (stuff->data == X_ChangeDeviceDontPropagateList) else if (stuff->data == X_ChangeDeviceDontPropagateList)
return(ProcXChangeDeviceDontPropagateList(client)); return (ProcXChangeDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceDontPropagateList) else if (stuff->data == X_GetDeviceDontPropagateList)
return(ProcXGetDeviceDontPropagateList(client)); return (ProcXGetDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceMotionEvents) else if (stuff->data == X_GetDeviceMotionEvents)
return(ProcXGetDeviceMotionEvents(client)); return (ProcXGetDeviceMotionEvents(client));
else if (stuff->data == X_ChangeKeyboardDevice) else if (stuff->data == X_ChangeKeyboardDevice)
return(ProcXChangeKeyboardDevice(client)); return (ProcXChangeKeyboardDevice(client));
else if (stuff->data == X_ChangePointerDevice) else if (stuff->data == X_ChangePointerDevice)
return(ProcXChangePointerDevice(client)); return (ProcXChangePointerDevice(client));
else if (stuff->data == X_GrabDevice) else if (stuff->data == X_GrabDevice)
return(ProcXGrabDevice(client)); return (ProcXGrabDevice(client));
else if (stuff->data == X_UngrabDevice) else if (stuff->data == X_UngrabDevice)
return(ProcXUngrabDevice(client)); return (ProcXUngrabDevice(client));
else if (stuff->data == X_GrabDeviceKey) else if (stuff->data == X_GrabDeviceKey)
return(ProcXGrabDeviceKey(client)); return (ProcXGrabDeviceKey(client));
else if (stuff->data == X_UngrabDeviceKey) else if (stuff->data == X_UngrabDeviceKey)
return(ProcXUngrabDeviceKey(client)); return (ProcXUngrabDeviceKey(client));
else if (stuff->data == X_GrabDeviceButton) else if (stuff->data == X_GrabDeviceButton)
return(ProcXGrabDeviceButton(client)); return (ProcXGrabDeviceButton(client));
else if (stuff->data == X_UngrabDeviceButton) else if (stuff->data == X_UngrabDeviceButton)
return(ProcXUngrabDeviceButton(client)); return (ProcXUngrabDeviceButton(client));
else if (stuff->data == X_AllowDeviceEvents) else if (stuff->data == X_AllowDeviceEvents)
return(ProcXAllowDeviceEvents(client)); return (ProcXAllowDeviceEvents(client));
else if (stuff->data == X_GetDeviceFocus) else if (stuff->data == X_GetDeviceFocus)
return(ProcXGetDeviceFocus(client)); return (ProcXGetDeviceFocus(client));
else if (stuff->data == X_SetDeviceFocus) else if (stuff->data == X_SetDeviceFocus)
return(ProcXSetDeviceFocus(client)); return (ProcXSetDeviceFocus(client));
else if (stuff->data == X_GetFeedbackControl) else if (stuff->data == X_GetFeedbackControl)
return(ProcXGetFeedbackControl(client)); return (ProcXGetFeedbackControl(client));
else if (stuff->data == X_ChangeFeedbackControl) else if (stuff->data == X_ChangeFeedbackControl)
return(ProcXChangeFeedbackControl(client)); return (ProcXChangeFeedbackControl(client));
else if (stuff->data == X_GetDeviceKeyMapping) else if (stuff->data == X_GetDeviceKeyMapping)
return(ProcXGetDeviceKeyMapping(client)); return (ProcXGetDeviceKeyMapping(client));
else if (stuff->data == X_ChangeDeviceKeyMapping) else if (stuff->data == X_ChangeDeviceKeyMapping)
return(ProcXChangeDeviceKeyMapping(client)); return (ProcXChangeDeviceKeyMapping(client));
else if (stuff->data == X_GetDeviceModifierMapping) else if (stuff->data == X_GetDeviceModifierMapping)
return(ProcXGetDeviceModifierMapping(client)); return (ProcXGetDeviceModifierMapping(client));
else if (stuff->data == X_SetDeviceModifierMapping) else if (stuff->data == X_SetDeviceModifierMapping)
return(ProcXSetDeviceModifierMapping(client)); return (ProcXSetDeviceModifierMapping(client));
else if (stuff->data == X_GetDeviceButtonMapping) else if (stuff->data == X_GetDeviceButtonMapping)
return(ProcXGetDeviceButtonMapping(client)); return (ProcXGetDeviceButtonMapping(client));
else if (stuff->data == X_SetDeviceButtonMapping) else if (stuff->data == X_SetDeviceButtonMapping)
return(ProcXSetDeviceButtonMapping(client)); return (ProcXSetDeviceButtonMapping(client));
else if (stuff->data == X_QueryDeviceState) else if (stuff->data == X_QueryDeviceState)
return(ProcXQueryDeviceState(client)); return (ProcXQueryDeviceState(client));
else if (stuff->data == X_SendExtensionEvent) else if (stuff->data == X_SendExtensionEvent)
return(ProcXSendExtensionEvent(client)); return (ProcXSendExtensionEvent(client));
else if (stuff->data == X_DeviceBell) else if (stuff->data == X_DeviceBell)
return(ProcXDeviceBell(client)); return (ProcXDeviceBell(client));
else if (stuff->data == X_SetDeviceValuators) else if (stuff->data == X_SetDeviceValuators)
return(ProcXSetDeviceValuators(client)); return (ProcXSetDeviceValuators(client));
else if (stuff->data == X_GetDeviceControl) else if (stuff->data == X_GetDeviceControl)
return(ProcXGetDeviceControl(client)); return (ProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl) else if (stuff->data == X_ChangeDeviceControl)
return(ProcXChangeDeviceControl(client)); return (ProcXChangeDeviceControl(client));
else else {
{
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest); SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return(BadRequest);
} }
return (BadRequest);
}
/******************************************************************************* /*******************************************************************************
* *
...@@ -352,86 +349,84 @@ ProcIDispatch (client) ...@@ -352,86 +349,84 @@ ProcIDispatch (client)
*/ */
int int
SProcIDispatch(client) SProcIDispatch(register ClientPtr client)
register ClientPtr client;
{ {
REQUEST(xReq); REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion) if (stuff->data == X_GetExtensionVersion)
return(SProcXGetExtensionVersion(client)); return (SProcXGetExtensionVersion(client));
if (stuff->data == X_ListInputDevices) if (stuff->data == X_ListInputDevices)
return(SProcXListInputDevices(client)); return (SProcXListInputDevices(client));
else if (stuff->data == X_OpenDevice) else if (stuff->data == X_OpenDevice)
return(SProcXOpenDevice(client)); return (SProcXOpenDevice(client));
else if (stuff->data == X_CloseDevice) else if (stuff->data == X_CloseDevice)
return(SProcXCloseDevice(client)); return (SProcXCloseDevice(client));
else if (stuff->data == X_SetDeviceMode) else if (stuff->data == X_SetDeviceMode)
return(SProcXSetDeviceMode(client)); return (SProcXSetDeviceMode(client));
else if (stuff->data == X_SelectExtensionEvent) else if (stuff->data == X_SelectExtensionEvent)
return(SProcXSelectExtensionEvent(client)); return (SProcXSelectExtensionEvent(client));
else if (stuff->data == X_GetSelectedExtensionEvents) else if (stuff->data == X_GetSelectedExtensionEvents)
return(SProcXGetSelectedExtensionEvents(client)); return (SProcXGetSelectedExtensionEvents(client));
else if (stuff->data == X_ChangeDeviceDontPropagateList) else if (stuff->data == X_ChangeDeviceDontPropagateList)
return(SProcXChangeDeviceDontPropagateList(client)); return (SProcXChangeDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceDontPropagateList) else if (stuff->data == X_GetDeviceDontPropagateList)
return(SProcXGetDeviceDontPropagateList(client)); return (SProcXGetDeviceDontPropagateList(client));
else if (stuff->data == X_GetDeviceMotionEvents) else if (stuff->data == X_GetDeviceMotionEvents)
return(SProcXGetDeviceMotionEvents(client)); return (SProcXGetDeviceMotionEvents(client));
else if (stuff->data == X_ChangeKeyboardDevice) else if (stuff->data == X_ChangeKeyboardDevice)
return(SProcXChangeKeyboardDevice(client)); return (SProcXChangeKeyboardDevice(client));
else if (stuff->data == X_ChangePointerDevice) else if (stuff->data == X_ChangePointerDevice)
return(SProcXChangePointerDevice(client)); return (SProcXChangePointerDevice(client));
else if (stuff->data == X_GrabDevice) else if (stuff->data == X_GrabDevice)
return(SProcXGrabDevice(client)); return (SProcXGrabDevice(client));
else if (stuff->data == X_UngrabDevice) else if (stuff->data == X_UngrabDevice)
return(SProcXUngrabDevice(client)); return (SProcXUngrabDevice(client));
else if (stuff->data == X_GrabDeviceKey) else if (stuff->data == X_GrabDeviceKey)
return(SProcXGrabDeviceKey(client)); return (SProcXGrabDeviceKey(client));
else if (stuff->data == X_UngrabDeviceKey) else if (stuff->data == X_UngrabDeviceKey)
return(SProcXUngrabDeviceKey(client)); return (SProcXUngrabDeviceKey(client));
else if (stuff->data == X_GrabDeviceButton) else if (stuff->data == X_GrabDeviceButton)
return(SProcXGrabDeviceButton(client)); return (SProcXGrabDeviceButton(client));
else if (stuff->data == X_UngrabDeviceButton) else if (stuff->data == X_UngrabDeviceButton)
return(SProcXUngrabDeviceButton(client)); return (SProcXUngrabDeviceButton(client));
else if (stuff->data == X_AllowDeviceEvents) else if (stuff->data == X_AllowDeviceEvents)
return(SProcXAllowDeviceEvents(client)); return (SProcXAllowDeviceEvents(client));
else if (stuff->data == X_GetDeviceFocus) else if (stuff->data == X_GetDeviceFocus)
return(SProcXGetDeviceFocus(client)); return (SProcXGetDeviceFocus(client));
else if (stuff->data == X_SetDeviceFocus) else if (stuff->data == X_SetDeviceFocus)
return(SProcXSetDeviceFocus(client)); return (SProcXSetDeviceFocus(client));
else if (stuff->data == X_GetFeedbackControl) else if (stuff->data == X_GetFeedbackControl)
return(SProcXGetFeedbackControl(client)); return (SProcXGetFeedbackControl(client));
else if (stuff->data == X_ChangeFeedbackControl) else if (stuff->data == X_ChangeFeedbackControl)
return(SProcXChangeFeedbackControl(client)); return (SProcXChangeFeedbackControl(client));
else if (stuff->data == X_GetDeviceKeyMapping) else if (stuff->data == X_GetDeviceKeyMapping)
return(SProcXGetDeviceKeyMapping(client)); return (SProcXGetDeviceKeyMapping(client));
else if (stuff->data == X_ChangeDeviceKeyMapping) else if (stuff->data == X_ChangeDeviceKeyMapping)
return(SProcXChangeDeviceKeyMapping(client)); return (SProcXChangeDeviceKeyMapping(client));
else if (stuff->data == X_GetDeviceModifierMapping) else if (stuff->data == X_GetDeviceModifierMapping)
return(SProcXGetDeviceModifierMapping(client)); return (SProcXGetDeviceModifierMapping(client));
else if (stuff->data == X_SetDeviceModifierMapping) else if (stuff->data == X_SetDeviceModifierMapping)
return(SProcXSetDeviceModifierMapping(client)); return (SProcXSetDeviceModifierMapping(client));
else if (stuff->data == X_GetDeviceButtonMapping) else if (stuff->data == X_GetDeviceButtonMapping)
return(SProcXGetDeviceButtonMapping(client)); return (SProcXGetDeviceButtonMapping(client));
else if (stuff->data == X_SetDeviceButtonMapping) else if (stuff->data == X_SetDeviceButtonMapping)
return(SProcXSetDeviceButtonMapping(client)); return (SProcXSetDeviceButtonMapping(client));
else if (stuff->data == X_QueryDeviceState) else if (stuff->data == X_QueryDeviceState)
return(SProcXQueryDeviceState(client)); return (SProcXQueryDeviceState(client));
else if (stuff->data == X_SendExtensionEvent) else if (stuff->data == X_SendExtensionEvent)
return(SProcXSendExtensionEvent(client)); return (SProcXSendExtensionEvent(client));
else if (stuff->data == X_DeviceBell) else if (stuff->data == X_DeviceBell)
return(SProcXDeviceBell(client)); return (SProcXDeviceBell(client));
else if (stuff->data == X_SetDeviceValuators) else if (stuff->data == X_SetDeviceValuators)
return(SProcXSetDeviceValuators(client)); return (SProcXSetDeviceValuators(client));
else if (stuff->data == X_GetDeviceControl) else if (stuff->data == X_GetDeviceControl)
return(SProcXGetDeviceControl(client)); return (SProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl) else if (stuff->data == X_ChangeDeviceControl)
return(SProcXChangeDeviceControl(client)); return (SProcXChangeDeviceControl(client));
else else {
{
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest); SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return(BadRequest);
} }
return (BadRequest);
}
/********************************************************************** /**********************************************************************
* *
...@@ -446,58 +441,69 @@ SProcIDispatch(client) ...@@ -446,58 +441,69 @@ SProcIDispatch(client)
SRepX##code (client, len, (x##code##Reply *) rep) SRepX##code (client, len, (x##code##Reply *) rep)
void void
SReplyIDispatch (client, len, rep) SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
ClientPtr client; /* All we look at is the type field */
int len; { /* This is common to all replies */
xGrabDeviceReply *rep; /* All we look at is the type field */
{ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion) if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep); SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
else if (rep->RepType == X_ListInputDevices) else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep); SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice) else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep); SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode) else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep); SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents) else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep); SRepXGetSelectedExtensionEvents(client, len,
(xGetSelectedExtensionEventsReply *)
rep);
else if (rep->RepType == X_GetDeviceDontPropagateList) else if (rep->RepType == X_GetDeviceDontPropagateList)
SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep); SRepXGetDeviceDontPropagateList(client, len,
(xGetDeviceDontPropagateListReply *)
rep);
else if (rep->RepType == X_GetDeviceMotionEvents) else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep); SRepXGetDeviceMotionEvents(client, len,
(xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_ChangeKeyboardDevice) else if (rep->RepType == X_ChangeKeyboardDevice)
SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep); SRepXChangeKeyboardDevice(client, len,
(xChangeKeyboardDeviceReply *) rep);
else if (rep->RepType == X_ChangePointerDevice) else if (rep->RepType == X_ChangePointerDevice)
SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep); SRepXChangePointerDevice(client, len,
(xChangePointerDeviceReply *) rep);
else if (rep->RepType == X_GrabDevice) else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep); SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus) else if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep); SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
else if (rep->RepType == X_GetFeedbackControl) else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep); SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
else if (rep->RepType == X_GetDeviceKeyMapping) else if (rep->RepType == X_GetDeviceKeyMapping)
SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep); SRepXGetDeviceKeyMapping(client, len,
(xGetDeviceKeyMappingReply *) rep);
else if (rep->RepType == X_GetDeviceModifierMapping) else if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep); SRepXGetDeviceModifierMapping(client, len,
(xGetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_SetDeviceModifierMapping) else if (rep->RepType == X_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep); SRepXSetDeviceModifierMapping(client, len,
(xSetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_GetDeviceButtonMapping) else if (rep->RepType == X_GetDeviceButtonMapping)
SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep); SRepXGetDeviceButtonMapping(client, len,
(xGetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_SetDeviceButtonMapping) else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep); SRepXSetDeviceButtonMapping(client, len,
(xSetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_QueryDeviceState) else if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep); SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators) else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep); SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
else if (rep->RepType == X_GetDeviceControl) else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep); SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
else if (rep->RepType == X_ChangeDeviceControl) else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep); SRepXChangeDeviceControl(client, len,
else (xChangeDeviceControlReply *) rep);
{ else {
FatalError("XINPUT confused sending swapped reply"); FatalError("XINPUT confused sending swapped reply");
}
} }
}
/***************************************************************************** /*****************************************************************************
* *
...@@ -508,68 +514,51 @@ SReplyIDispatch (client, len, rep) ...@@ -508,68 +514,51 @@ SReplyIDispatch (client, len, rep)
#define DO_SWAP(func,type) func ((type *)from, (type *)to) #define DO_SWAP(func,type) func ((type *)from, (type *)to)
void void
SEventIDispatch (from, to) SEventIDispatch(xEvent * from, xEvent * to)
xEvent *from;
xEvent *to;
{ {
int type = from->u.u.type & 0177; int type = from->u.u.type & 0177;
if (type == DeviceValuator) if (type == DeviceValuator)
DO_SWAP(SEventDeviceValuator, deviceValuator); DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress) else if (type == DeviceKeyPress) {
{ SKeyButtonPtrEvent(from, to);
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == DeviceKeyRelease) {
else if (type == DeviceKeyRelease) SKeyButtonPtrEvent(from, to);
{
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == DeviceButtonPress) {
else if (type == DeviceButtonPress) SKeyButtonPtrEvent(from, to);
{
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == DeviceButtonRelease) {
else if (type == DeviceButtonRelease) SKeyButtonPtrEvent(from, to);
{
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == DeviceMotionNotify) {
else if (type == DeviceMotionNotify) SKeyButtonPtrEvent(from, to);
{
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == DeviceFocusIn)
else if (type == DeviceFocusIn) DO_SWAP(SEventFocus, deviceFocus);
DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut) else if (type == DeviceFocusOut)
DO_SWAP(SEventFocus, deviceFocus); DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn) else if (type == ProximityIn) {
{ SKeyButtonPtrEvent(from, to);
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == ProximityOut) {
else if (type == ProximityOut) SKeyButtonPtrEvent(from, to);
{
SKeyButtonPtrEvent (from, to);
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
} } else if (type == DeviceStateNotify)
else if (type == DeviceStateNotify) DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify) else if (type == DeviceKeyStateNotify)
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify) else if (type == DeviceButtonStateNotify)
DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify) else if (type == DeviceMappingNotify)
DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify) else if (type == ChangeDeviceNotify)
DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else else {
{
FatalError("XInputExtension: Impossible event!\n"); FatalError("XInputExtension: Impossible event!\n");
}
} }
}
/************************************************************************ /************************************************************************
* *
...@@ -578,11 +567,9 @@ SEventIDispatch (from, to) ...@@ -578,11 +567,9 @@ SEventIDispatch (from, to)
*/ */
void void
SEventDeviceValuator (from, to) SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
deviceValuator *from; {
deviceValuator *to; register int i;
{
register int i;
INT32 *ip B32; INT32 *ip B32;
*to = *from; *to = *from;
...@@ -591,76 +578,65 @@ SEventDeviceValuator (from, to) ...@@ -591,76 +578,65 @@ SEventDeviceValuator (from, to)
ip = &to->valuator0; ip = &to->valuator0;
for (i=0; i<6; i++) for (i=0; i<6; i++)
{ {
swapl((ip+i)); /* macro - braces are required */ swapl((ip + i)); /* macro - braces are required */
}
} }
}
void void
SEventFocus (from, to) SEventFocus(deviceFocus * from, deviceFocus * to)
deviceFocus *from;
deviceFocus *to;
{ {
*to = *from; *to = *from;
swaps(&to->sequenceNumber); swaps(&to->sequenceNumber);
swapl(&to->time); swapl(&to->time);
swapl(&to->window); swapl(&to->window);
} }
void void
SDeviceStateNotifyEvent (from, to) SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
deviceStateNotify *from;
deviceStateNotify *to;
{ {
register int i; register int i;
INT32 *ip B32; INT32 *ip B32;
*to = *from; *to = *from;
swaps(&to->sequenceNumber); swaps(&to->sequenceNumber);
swapl(&to->time); swapl(&to->time);
ip = &to->valuator0; ip = &to->valuator0;
for (i=0; i<3; i++) for (i = 0; i < 3; i++) {
{ swapl((ip + i)); /* macro - braces are required */
swapl((ip+i)); /* macro - braces are required */
}
} }
}
void void
SDeviceKeyStateNotifyEvent (from, to) SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
deviceKeyStateNotify *from; deviceKeyStateNotify * to)
deviceKeyStateNotify *to;
{ {
*to = *from; *to = *from;
swaps(&to->sequenceNumber); swaps(&to->sequenceNumber);
} }
void void
SDeviceButtonStateNotifyEvent (from, to) SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
deviceButtonStateNotify *from; deviceButtonStateNotify * to)
deviceButtonStateNotify *to;
{ {
*to = *from; *to = *from;
swaps(&to->sequenceNumber); swaps(&to->sequenceNumber);
} }
void void
SChangeDeviceNotifyEvent (from, to) SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
changeDeviceNotify *from;
changeDeviceNotify *to;
{ {
*to = *from; *to = *from;
swaps(&to->sequenceNumber); swaps(&to->sequenceNumber);
swapl(&to->time); swapl(&to->time);
} }
void void
SDeviceMappingNotifyEvent (from, to) SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
deviceMappingNotify *from;
deviceMappingNotify *to;
{ {
*to = *from; *to = *from;
swaps(&to->sequenceNumber); swaps(&to->sequenceNumber);
swapl(&to->time); swapl(&to->time);
} }
/************************************************************************ /************************************************************************
* *
...@@ -669,25 +645,24 @@ SDeviceMappingNotifyEvent (from, to) ...@@ -669,25 +645,24 @@ SDeviceMappingNotifyEvent (from, to)
*/ */
void void
FixExtensionEvents (extEntry) FixExtensionEvents(ExtensionEntry * extEntry)
ExtensionEntry *extEntry;
{ {
Mask mask; Mask mask;
DeviceValuator = extEntry->eventBase; DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1; DeviceKeyPress = DeviceValuator + 1;
DeviceKeyRelease = DeviceKeyPress + 1; DeviceKeyRelease = DeviceKeyPress + 1;
DeviceButtonPress = DeviceKeyRelease + 1; DeviceButtonPress = DeviceKeyRelease + 1;
DeviceButtonRelease = DeviceButtonPress + 1; DeviceButtonRelease = DeviceButtonPress + 1;
DeviceMotionNotify = DeviceButtonRelease + 1; DeviceMotionNotify = DeviceButtonRelease + 1;
DeviceFocusIn = DeviceMotionNotify + 1; DeviceFocusIn = DeviceMotionNotify + 1;
DeviceFocusOut = DeviceFocusIn + 1; DeviceFocusOut = DeviceFocusIn + 1;
ProximityIn = DeviceFocusOut + 1; ProximityIn = DeviceFocusOut + 1;
ProximityOut = ProximityIn + 1; ProximityOut = ProximityIn + 1;
DeviceStateNotify = ProximityOut + 1; DeviceStateNotify = ProximityOut + 1;
DeviceMappingNotify = DeviceStateNotify + 1; DeviceMappingNotify = DeviceStateNotify + 1;
ChangeDeviceNotify = DeviceMappingNotify + 1; ChangeDeviceNotify = DeviceMappingNotify + 1;
DeviceKeyStateNotify = ChangeDeviceNotify + 1; DeviceKeyStateNotify = ChangeDeviceNotify + 1;
DeviceButtonStateNotify = DeviceKeyStateNotify + 1; DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
event_base[KeyClass] = DeviceKeyPress; event_base[KeyClass] = DeviceKeyPress;
...@@ -703,66 +678,66 @@ FixExtensionEvents (extEntry) ...@@ -703,66 +678,66 @@ FixExtensionEvents (extEntry)
DeviceBusy += extEntry->errorBase; DeviceBusy += extEntry->errorBase;
BadClass += extEntry->errorBase; BadClass += extEntry->errorBase;
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, DeviceKeyPress); SetMaskForExtEvent(mask, DeviceKeyPress);
AllowPropagateSuppress (mask); AllowPropagateSuppress(mask);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, DeviceKeyRelease); SetMaskForExtEvent(mask, DeviceKeyRelease);
AllowPropagateSuppress (mask); AllowPropagateSuppress(mask);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, DeviceButtonPress); SetMaskForExtEvent(mask, DeviceButtonPress);
AllowPropagateSuppress (mask); AllowPropagateSuppress(mask);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, DeviceButtonRelease); SetMaskForExtEvent(mask, DeviceButtonRelease);
AllowPropagateSuppress (mask); AllowPropagateSuppress(mask);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, ProximityIn); SetMaskForExtEvent(mask, ProximityIn);
SetMaskForExtEvent (mask, ProximityOut); SetMaskForExtEvent(mask, ProximityOut);
AllowPropagateSuppress (mask); AllowPropagateSuppress(mask);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
DeviceStateNotifyMask = mask; DeviceStateNotifyMask = mask;
SetMaskForExtEvent (mask, DeviceStateNotify); SetMaskForExtEvent(mask, DeviceStateNotify);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
DevicePointerMotionMask = mask; DevicePointerMotionMask = mask;
SetMaskForExtEvent (mask, DeviceMotionNotify); SetMaskForExtEvent(mask, DeviceMotionNotify);
AllowPropagateSuppress (mask); AllowPropagateSuppress(mask);
DevicePointerMotionHintMask = GetNextExtEventMask(); DevicePointerMotionHintMask = GetNextExtEventMask();
SetEventInfo (DevicePointerMotionHintMask, _devicePointerMotionHint); SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
SetEventInfo (GetNextExtEventMask(), _deviceButton1Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton1Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton2Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton2Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton3Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton3Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton4Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton4Motion);
SetEventInfo (GetNextExtEventMask(), _deviceButton5Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton5Motion);
DeviceButtonMotionMask = GetNextExtEventMask(); DeviceButtonMotionMask = GetNextExtEventMask();
SetEventInfo (DeviceButtonMotionMask, _deviceButtonMotion); SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion);
DeviceFocusChangeMask = GetNextExtEventMask (); DeviceFocusChangeMask = GetNextExtEventMask();
SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusIn); SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn);
SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusOut); SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut);
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, DeviceMappingNotify); SetMaskForExtEvent(mask, DeviceMappingNotify);
DeviceMappingNotifyMask = mask; DeviceMappingNotifyMask = mask;
mask = GetNextExtEventMask (); mask = GetNextExtEventMask();
SetMaskForExtEvent (mask, ChangeDeviceNotify); SetMaskForExtEvent(mask, ChangeDeviceNotify);
ChangeDeviceNotifyMask = mask; ChangeDeviceNotifyMask = mask;
DeviceButtonGrabMask = GetNextExtEventMask(); DeviceButtonGrabMask = GetNextExtEventMask();
SetEventInfo (DeviceButtonGrabMask, _deviceButtonGrab); SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess (DeviceButtonGrabMask); SetExclusiveAccess(DeviceButtonGrabMask);
DeviceOwnerGrabButtonMask = GetNextExtEventMask(); DeviceOwnerGrabButtonMask = GetNextExtEventMask();
SetEventInfo (DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton); SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo (0, _noExtensionEvent); SetEventInfo(0, _noExtensionEvent);
} }
/************************************************************************ /************************************************************************
* *
...@@ -772,19 +747,18 @@ FixExtensionEvents (extEntry) ...@@ -772,19 +747,18 @@ FixExtensionEvents (extEntry)
*/ */
void void
RestoreExtensionEvents () RestoreExtensionEvents(void)
{ {
int i; int i;
IReqCode = 0; IReqCode = 0;
for (i=0; i<ExtEventIndex-1; i++) for (i = 0; i < ExtEventIndex - 1; i++) {
{
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
SetMaskForEvent(0,EventInfo[i].type); SetMaskForEvent(0, EventInfo[i].type);
EventInfo[i].mask = 0; EventInfo[i].mask = 0;
EventInfo[i].type = 0; EventInfo[i].type = 0;
} }
ExtEventIndex = 0; ExtEventIndex = 0;
lastExtEventMask = 1; lastExtEventMask = 1;
DeviceValuator = 0; DeviceValuator = 0;
...@@ -809,7 +783,7 @@ RestoreExtensionEvents () ...@@ -809,7 +783,7 @@ RestoreExtensionEvents ()
DeviceBusy = 3; DeviceBusy = 3;
BadClass = 4; BadClass = 4;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -820,9 +794,8 @@ RestoreExtensionEvents () ...@@ -820,9 +794,8 @@ RestoreExtensionEvents ()
*/ */
void void
IResetProc(unused) IResetProc(ExtensionEntry * unused)
ExtensionEntry *unused; {
{
ReplySwapVector[IReqCode] = ReplyNotSwappd; ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented; EventSwapVector[DeviceValuator] = NotImplemented;
...@@ -840,8 +813,8 @@ IResetProc(unused) ...@@ -840,8 +813,8 @@ IResetProc(unused)
EventSwapVector[DeviceButtonStateNotify] = NotImplemented; EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
EventSwapVector[DeviceMappingNotify] = NotImplemented; EventSwapVector[DeviceMappingNotify] = NotImplemented;
EventSwapVector[ChangeDeviceNotify] = NotImplemented; EventSwapVector[ChangeDeviceNotify] = NotImplemented;
RestoreExtensionEvents (); RestoreExtensionEvents();
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -849,16 +822,13 @@ IResetProc(unused) ...@@ -849,16 +822,13 @@ IResetProc(unused)
* *
*/ */
void void
AssignTypeAndName (dev, type, name) AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
DeviceIntPtr dev;
Atom type;
char *name;
{ {
dev->type = type; dev->type = type;
dev->name = (char *) malloc(strlen(name)+1); dev->name = (char *)malloc(strlen(name) + 1);
strcpy (dev->name, name); strcpy(dev->name, name);
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -867,14 +837,14 @@ AssignTypeAndName (dev, type, name) ...@@ -867,14 +837,14 @@ AssignTypeAndName (dev, type, name)
*/ */
void void
MakeDeviceTypeAtoms () MakeDeviceTypeAtoms(void)
{ {
int i; int i;
for (i=0; i<NUMTYPES; i++) for (i = 0; i < NUMTYPES; i++)
dev_type[i].type = dev_type[i].type =
MakeAtom (dev_type[i].name, strlen(dev_type[i].name), 1); MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1);
} }
/************************************************************************** /**************************************************************************
* *
...@@ -884,22 +854,19 @@ MakeDeviceTypeAtoms () ...@@ -884,22 +854,19 @@ MakeDeviceTypeAtoms ()
*/ */
DeviceIntPtr DeviceIntPtr
LookupDeviceIntRec ( LookupDeviceIntRec(CARD8 id)
CARD8 id)
{ {
DeviceIntPtr dev; DeviceIntPtr dev;
for (dev=inputInfo.devices; dev; dev=dev->next) for (dev = inputInfo.devices; dev; dev = dev->next) {
{ if (dev->id == id) {
if (dev->id == id)
{
if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id) if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id)
return (NULL); return (NULL);
return (dev); return (dev);
}
} }
return (NULL);
} }
return (NULL);
}
/************************************************************************** /**************************************************************************
* *
...@@ -910,14 +877,13 @@ LookupDeviceIntRec ( ...@@ -910,14 +877,13 @@ LookupDeviceIntRec (
*/ */
void void
SetExclusiveAccess (mask) SetExclusiveAccess(Mask mask)
Mask mask; {
{
int i; int i;
for (i=0; i<MAX_DEVICES; i++) for (i = 0; i < MAX_DEVICES; i++)
ExtExclusiveMasks[i] |= mask; ExtExclusiveMasks[i] |= mask;
} }
/************************************************************************** /**************************************************************************
* *
...@@ -927,14 +893,13 @@ SetExclusiveAccess (mask) ...@@ -927,14 +893,13 @@ SetExclusiveAccess (mask)
*/ */
void void
AllowPropagateSuppress (mask) AllowPropagateSuppress(Mask mask)
Mask mask; {
{
int i; int i;
for (i=0; i<MAX_DEVICES; i++) for (i = 0; i < MAX_DEVICES; i++)
PropagateMask[i] |= mask; PropagateMask[i] |= mask;
} }
/************************************************************************** /**************************************************************************
* *
...@@ -942,22 +907,21 @@ AllowPropagateSuppress (mask) ...@@ -942,22 +907,21 @@ AllowPropagateSuppress (mask)
* *
*/ */
Mask Mask
GetNextExtEventMask () GetNextExtEventMask(void)
{ {
int i; int i;
Mask mask = lastExtEventMask; Mask mask = lastExtEventMask;
if (lastExtEventMask == 0) if (lastExtEventMask == 0) {
{
FatalError("GetNextExtEventMask: no more events are available."); FatalError("GetNextExtEventMask: no more events are available.");
} }
lastExtEventMask <<= 1; lastExtEventMask <<= 1;
for (i=0; i<MAX_DEVICES; i++) for (i = 0; i < MAX_DEVICES; i++)
ExtValidMasks[i] |= mask; ExtValidMasks[i] |= mask;
return mask; return mask;
} }
/************************************************************************** /**************************************************************************
* *
...@@ -966,18 +930,16 @@ GetNextExtEventMask () ...@@ -966,18 +930,16 @@ GetNextExtEventMask ()
*/ */
void void
SetMaskForExtEvent(mask, event) SetMaskForExtEvent(Mask mask, int event)
Mask mask; {
int event;
{
EventInfo[ExtEventIndex].mask = mask; EventInfo[ExtEventIndex].mask = mask;
EventInfo[ExtEventIndex++].type = event; EventInfo[ExtEventIndex++].type = event;
if ((event < LASTEvent) || (event >= 128)) if ((event < LASTEvent) || (event >= 128))
FatalError("MaskForExtensionEvent: bogus event number"); FatalError("MaskForExtensionEvent: bogus event number");
SetMaskForEvent(mask,event); SetMaskForEvent(mask, event);
} }
/************************************************************************** /**************************************************************************
* *
...@@ -993,10 +955,8 @@ SetMaskForExtEvent(mask, event) ...@@ -993,10 +955,8 @@ SetMaskForExtEvent(mask, event)
*/ */
void void
SetEventInfo(mask, constant) SetEventInfo(Mask mask, int constant)
Mask mask; {
int constant;
{
EventInfo[ExtEventIndex].mask = mask; EventInfo[ExtEventIndex].mask = mask;
EventInfo[ExtEventIndex++].type = constant; EventInfo[ExtEventIndex++].type = constant;
} }
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "getbmap.h" #include "getbmap.h"
...@@ -73,13 +73,12 @@ SOFTWARE. ...@@ -73,13 +73,12 @@ SOFTWARE.
*/ */
int int
SProcXGetDeviceButtonMapping(client) SProcXGetDeviceButtonMapping(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceButtonMappingReq); REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXGetDeviceButtonMapping(client)); return (ProcXGetDeviceButtonMapping(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -88,12 +87,11 @@ SProcXGetDeviceButtonMapping(client) ...@@ -88,12 +87,11 @@ SProcXGetDeviceButtonMapping(client)
*/ */
int int
ProcXGetDeviceButtonMapping (client) ProcXGetDeviceButtonMapping(register ClientPtr client)
register ClientPtr client; {
{ DeviceIntPtr dev;
DeviceIntPtr dev; xGetDeviceButtonMappingReply rep;
xGetDeviceButtonMappingReply rep; ButtonClassPtr b;
ButtonClassPtr b;
REQUEST(xGetDeviceButtonMappingReq); REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq); REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
...@@ -104,28 +102,25 @@ ProcXGetDeviceButtonMapping (client) ...@@ -104,28 +102,25 @@ ProcXGetDeviceButtonMapping (client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
b = dev->button; b = dev->button;
if (b == NULL) if (b == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, BadMatch);
BadMatch);
return Success; return Success;
} }
rep.nElts = b->numButtons; rep.nElts = b->numButtons;
rep.length = (rep.nElts + (4-1))/4; rep.length = (rep.nElts + (4 - 1)) / 4;
WriteReplyToClient (client, sizeof (xGetDeviceButtonMappingReply), &rep); WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts, WriteToClient(client, rep.nElts, &b->map[1]);
(char *)&b->map[1]);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -135,12 +130,10 @@ ProcXGetDeviceButtonMapping (client) ...@@ -135,12 +130,10 @@ ProcXGetDeviceButtonMapping (client)
*/ */
void void
SRepXGetDeviceButtonMapping (client, size, rep) SRepXGetDeviceButtonMapping(ClientPtr client, int size,
ClientPtr client; xGetDeviceButtonMappingReply * rep)
int size; {
xGetDeviceButtonMappingReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETBMAP_H #ifndef GETBMAP_H
#define GETBMAP_H 1 #define GETBMAP_H 1
int int SProcXGetDeviceButtonMapping(ClientPtr /* client */
SProcXGetDeviceButtonMapping( );
ClientPtr /* client */
); int ProcXGetDeviceButtonMapping(ClientPtr /* client */
);
int
ProcXGetDeviceButtonMapping ( void SRepXGetDeviceButtonMapping(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetDeviceButtonMappingReply * /* rep */
);
void
SRepXGetDeviceButtonMapping (
ClientPtr /* client */,
int /* size */,
xGetDeviceButtonMappingReply * /* rep */
);
#endif /* GETBMAP_H */ #endif /* GETBMAP_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "getdctl.h" #include "getdctl.h"
...@@ -74,15 +74,14 @@ SOFTWARE. ...@@ -74,15 +74,14 @@ SOFTWARE.
*/ */
int int
SProcXGetDeviceControl(client) SProcXGetDeviceControl(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceControlReq); REQUEST(xGetDeviceControlReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq); REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control); swaps(&stuff->control);
return(ProcXGetDeviceControl(client)); return (ProcXGetDeviceControl(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -91,10 +90,9 @@ SProcXGetDeviceControl(client) ...@@ -91,10 +90,9 @@ SProcXGetDeviceControl(client)
*/ */
int int
ProcXGetDeviceControl(client) ProcXGetDeviceControl(ClientPtr client)
ClientPtr client; {
{ int total_length = 0;
int total_length = 0;
char *buf, *savbuf; char *buf, *savbuf;
register DeviceIntPtr dev; register DeviceIntPtr dev;
xGetDeviceControlReply rep; xGetDeviceControlReply rep;
...@@ -102,62 +100,53 @@ ProcXGetDeviceControl(client) ...@@ -102,62 +100,53 @@ ProcXGetDeviceControl(client)
REQUEST(xGetDeviceControlReq); REQUEST(xGetDeviceControlReq);
REQUEST_SIZE_MATCH(xGetDeviceControlReq); REQUEST_SIZE_MATCH(xGetDeviceControlReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice);
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
BadDevice);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl; rep.RepType = X_GetDeviceControl;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
switch (stuff->control) switch (stuff->control) {
{ case DEVICE_RESOLUTION:
case DEVICE_RESOLUTION: if (!dev->valuator) {
if (!dev->valuator) SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
{ BadMatch);
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; 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) if (!buf) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc);
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadAlloc);
return Success; return Success;
} }
savbuf=buf; savbuf = buf;
switch (stuff->control) switch (stuff->control) {
{ case DEVICE_RESOLUTION:
case DEVICE_RESOLUTION: CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
CopySwapDeviceResolution(client, dev->valuator, buf, break;
total_length); default:
break; break;
default: }
break;
}
rep.length = (total_length+3) >> 2; rep.length = (total_length + 3) >> 2;
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
free (savbuf); free(savbuf);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -166,40 +155,35 @@ ProcXGetDeviceControl(client) ...@@ -166,40 +155,35 @@ ProcXGetDeviceControl(client)
*/ */
void void
CopySwapDeviceResolution (client, v, buf, length) CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
ClientPtr client; int length)
ValuatorClassPtr v; {
char *buf; AxisInfoPtr a;
int length;
{
AxisInfoPtr a;
xDeviceResolutionState *r; xDeviceResolutionState *r;
int i, *iptr; int i, *iptr;
r = (xDeviceResolutionState *) buf; r = (xDeviceResolutionState *) buf;
r->control = DEVICE_RESOLUTION; r->control = DEVICE_RESOLUTION;
r->length = length; r->length = length;
r->num_valuators = v->numAxes; r->num_valuators = v->numAxes;
buf += sizeof (xDeviceResolutionState); buf += sizeof(xDeviceResolutionState);
iptr = (int *) buf; iptr = (int *)buf;
for (i=0,a=v->axes; i<v->numAxes; i++,a++) for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->resolution; *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; *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; *iptr++ = a->max_resolution;
if (client->swapped) if (client->swapped) {
{ swaps(&r->control);
swaps (&r->control); swaps(&r->length);
swaps (&r->length); swapl(&r->num_valuators);
swapl (&r->num_valuators); iptr = (int *)buf;
iptr = (int *) buf; for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
for (i=0; i < (3 * v->numAxes); i++,iptr++) swapl(iptr);
{
swapl (iptr);
}
} }
} }
}
/*********************************************************************** /***********************************************************************
* *
...@@ -209,13 +193,9 @@ CopySwapDeviceResolution (client, v, buf, length) ...@@ -209,13 +193,9 @@ CopySwapDeviceResolution (client, v, buf, length)
*/ */
void void
SRepXGetDeviceControl (client, size, rep) SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
ClientPtr client; {
int size;
xGetDeviceControlReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,29 +30,21 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,29 +30,21 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETDCTL_H #ifndef GETDCTL_H
#define GETDCTL_H 1 #define GETDCTL_H 1
int int SProcXGetDeviceControl(ClientPtr /* client */
SProcXGetDeviceControl ( );
ClientPtr /* client */
); int ProcXGetDeviceControl(ClientPtr /* client */
);
int
ProcXGetDeviceControl ( void CopySwapDeviceResolution(ClientPtr /* client */ ,
ClientPtr /* client */ ValuatorClassPtr /* v */ ,
); char * /* buf */ ,
int /* length */
void );
CopySwapDeviceResolution (
ClientPtr /* client */, void SRepXGetDeviceControl(ClientPtr /* client */ ,
ValuatorClassPtr /* v */, int /* size */ ,
char * /* buf */, xGetDeviceControlReply * /* rep */
int /* length */ );
);
void
SRepXGetDeviceControl (
ClientPtr /* client */,
int /* size */,
xGetDeviceControlReply * /* rep */
);
#endif /* GETDCTL_H */ #endif /* GETDCTL_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "getfctl.h" #include "getfctl.h"
...@@ -74,13 +74,12 @@ SOFTWARE. ...@@ -74,13 +74,12 @@ SOFTWARE.
*/ */
int int
SProcXGetFeedbackControl(client) SProcXGetFeedbackControl(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetFeedbackControlReq); REQUEST(xGetFeedbackControlReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXGetFeedbackControl(client)); return (ProcXGetFeedbackControl(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -89,10 +88,9 @@ SProcXGetFeedbackControl(client) ...@@ -89,10 +88,9 @@ SProcXGetFeedbackControl(client)
*/ */
int int
ProcXGetFeedbackControl(client) ProcXGetFeedbackControl(ClientPtr client)
ClientPtr client; {
{ int total_length = 0;
int total_length = 0;
char *buf, *savbuf; char *buf, *savbuf;
register DeviceIntPtr dev; register DeviceIntPtr dev;
KbdFeedbackPtr k; KbdFeedbackPtr k;
...@@ -106,13 +104,11 @@ ProcXGetFeedbackControl(client) ...@@ -106,13 +104,11 @@ ProcXGetFeedbackControl(client)
REQUEST(xGetFeedbackControlReq); REQUEST(xGetFeedbackControlReq);
REQUEST_SIZE_MATCH(xGetFeedbackControlReq); REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice);
SendErrorToClient (client, IReqCode, X_GetFeedbackControl, 0,
BadDevice);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetFeedbackControl; rep.RepType = X_GetFeedbackControl;
...@@ -120,73 +116,63 @@ ProcXGetFeedbackControl(client) ...@@ -120,73 +116,63 @@ ProcXGetFeedbackControl(client)
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.num_feedbacks = 0; rep.num_feedbacks = 0;
for (k=dev->kbdfeed; k; k=k->next) for (k = dev->kbdfeed; k; k = k->next) {
{
rep.num_feedbacks++; rep.num_feedbacks++;
total_length += sizeof(xKbdFeedbackState); total_length += sizeof(xKbdFeedbackState);
} }
for (p=dev->ptrfeed; p; p=p->next) for (p = dev->ptrfeed; p; p = p->next) {
{
rep.num_feedbacks++; rep.num_feedbacks++;
total_length += sizeof(xPtrFeedbackState); total_length += sizeof(xPtrFeedbackState);
} }
for (s=dev->stringfeed; s; s=s->next) for (s = dev->stringfeed; s; s = s->next) {
{
rep.num_feedbacks++; rep.num_feedbacks++;
total_length += sizeof(xStringFeedbackState) + total_length += sizeof(xStringFeedbackState) +
(s->ctrl.num_symbols_supported * sizeof (KeySym)); (s->ctrl.num_symbols_supported * sizeof(KeySym));
} }
for (i=dev->intfeed; i; i=i->next) for (i = dev->intfeed; i; i = i->next) {
{
rep.num_feedbacks++; rep.num_feedbacks++;
total_length += sizeof(xIntegerFeedbackState); total_length += sizeof(xIntegerFeedbackState);
} }
for (l=dev->leds; l; l=l->next) for (l = dev->leds; l; l = l->next) {
{
rep.num_feedbacks++; rep.num_feedbacks++;
total_length += sizeof(xLedFeedbackState); total_length += sizeof(xLedFeedbackState);
} }
for (b=dev->bell; b; b=b->next) for (b = dev->bell; b; b = b->next) {
{
rep.num_feedbacks++; rep.num_feedbacks++;
total_length += sizeof(xBellFeedbackState); total_length += sizeof(xBellFeedbackState);
} }
if (total_length == 0) if (total_length == 0) {
{ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch);
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
BadMatch);
return Success; return Success;
} }
buf = (char *) malloc (total_length); buf = (char *)malloc(total_length);
if (!buf) if (!buf) {
{ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc);
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
BadAlloc);
return Success; return Success;
} }
savbuf=buf; savbuf = buf;
for (k=dev->kbdfeed; k; k=k->next) for (k = dev->kbdfeed; k; k = k->next)
CopySwapKbdFeedback (client, k, &buf); CopySwapKbdFeedback(client, k, &buf);
for (p=dev->ptrfeed; p; p=p->next) for (p = dev->ptrfeed; p; p = p->next)
CopySwapPtrFeedback (client, p, &buf); CopySwapPtrFeedback(client, p, &buf);
for (s=dev->stringfeed; s; s=s->next) for (s = dev->stringfeed; s; s = s->next)
CopySwapStringFeedback (client, s, &buf); CopySwapStringFeedback(client, s, &buf);
for (i=dev->intfeed; i; i=i->next) for (i = dev->intfeed; i; i = i->next)
CopySwapIntegerFeedback (client, i, &buf); CopySwapIntegerFeedback(client, i, &buf);
for (l=dev->leds; l; l=l->next) for (l = dev->leds; l; l = l->next)
CopySwapLedFeedback (client, l, &buf); CopySwapLedFeedback(client, l, &buf);
for (b=dev->bell; b; b=b->next) for (b = dev->bell; b; b = b->next)
CopySwapBellFeedback (client, b, &buf); CopySwapBellFeedback(client, b, &buf);
rep.length = (total_length+3) >> 2; rep.length = (total_length + 3) >> 2;
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
free (savbuf); free(savbuf);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -195,17 +181,14 @@ ProcXGetFeedbackControl(client) ...@@ -195,17 +181,14 @@ ProcXGetFeedbackControl(client)
*/ */
void void
CopySwapKbdFeedback (client, k, buf) CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
ClientPtr client; {
KbdFeedbackPtr k; int i;
char **buf; xKbdFeedbackState *k2;
{
int i; k2 = (xKbdFeedbackState *) * buf;
xKbdFeedbackState *k2;
k2 = (xKbdFeedbackState *) *buf;
k2->class = KbdFeedbackClass; k2->class = KbdFeedbackClass;
k2->length = sizeof (xKbdFeedbackState); k2->length = sizeof(xKbdFeedbackState);
k2->id = k->ctrl.id; k2->id = k->ctrl.id;
k2->click = k->ctrl.click; k2->click = k->ctrl.click;
k2->percent = k->ctrl.bell; k2->percent = k->ctrl.bell;
...@@ -213,18 +196,17 @@ CopySwapKbdFeedback (client, k, buf) ...@@ -213,18 +196,17 @@ CopySwapKbdFeedback (client, k, buf)
k2->duration = k->ctrl.bell_duration; k2->duration = k->ctrl.bell_duration;
k2->led_mask = k->ctrl.leds; k2->led_mask = k->ctrl.leds;
k2->global_auto_repeat = k->ctrl.autoRepeat; 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]; k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
if (client->swapped) if (client->swapped) {
{
swaps(&k2->length); swaps(&k2->length);
swaps(&k2->pitch); swaps(&k2->pitch);
swaps(&k2->duration); swaps(&k2->duration);
swapl(&k2->led_mask); swapl(&k2->led_mask);
swapl(&k2->led_values); swapl(&k2->led_values);
}
*buf += sizeof (xKbdFeedbackState);
} }
*buf += sizeof(xKbdFeedbackState);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -233,29 +215,25 @@ CopySwapKbdFeedback (client, k, buf) ...@@ -233,29 +215,25 @@ CopySwapKbdFeedback (client, k, buf)
*/ */
void void
CopySwapPtrFeedback (client, p, buf) CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
ClientPtr client; {
PtrFeedbackPtr p; xPtrFeedbackState *p2;
char **buf;
{ p2 = (xPtrFeedbackState *) * buf;
xPtrFeedbackState *p2;
p2 = (xPtrFeedbackState *) *buf;
p2->class = PtrFeedbackClass; p2->class = PtrFeedbackClass;
p2->length = sizeof (xPtrFeedbackState); p2->length = sizeof(xPtrFeedbackState);
p2->id = p->ctrl.id; p2->id = p->ctrl.id;
p2->accelNum = p->ctrl.num; p2->accelNum = p->ctrl.num;
p2->accelDenom = p->ctrl.den; p2->accelDenom = p->ctrl.den;
p2->threshold = p->ctrl.threshold; p2->threshold = p->ctrl.threshold;
if (client->swapped) if (client->swapped) {
{
swaps(&p2->length); swaps(&p2->length);
swaps(&p2->accelNum); swaps(&p2->accelNum);
swaps(&p2->accelDenom); swaps(&p2->accelDenom);
swaps(&p2->threshold); swaps(&p2->threshold);
}
*buf += sizeof (xPtrFeedbackState);
} }
*buf += sizeof(xPtrFeedbackState);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -264,29 +242,25 @@ CopySwapPtrFeedback (client, p, buf) ...@@ -264,29 +242,25 @@ CopySwapPtrFeedback (client, p, buf)
*/ */
void void
CopySwapIntegerFeedback (client, i, buf) CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
ClientPtr client; {
IntegerFeedbackPtr i; xIntegerFeedbackState *i2;
char **buf;
{ i2 = (xIntegerFeedbackState *) * buf;
xIntegerFeedbackState *i2;
i2 = (xIntegerFeedbackState *) *buf;
i2->class = IntegerFeedbackClass; i2->class = IntegerFeedbackClass;
i2->length = sizeof (xIntegerFeedbackState); i2->length = sizeof(xIntegerFeedbackState);
i2->id = i->ctrl.id; i2->id = i->ctrl.id;
i2->resolution = i->ctrl.resolution; i2->resolution = i->ctrl.resolution;
i2->min_value = i->ctrl.min_value; i2->min_value = i->ctrl.min_value;
i2->max_value = i->ctrl.max_value; i2->max_value = i->ctrl.max_value;
if (client->swapped) if (client->swapped) {
{
swaps(&i2->length); swaps(&i2->length);
swapl(&i2->resolution); swapl(&i2->resolution);
swapl(&i2->min_value); swapl(&i2->min_value);
swapl(&i2->max_value); swapl(&i2->max_value);
}
*buf += sizeof (xIntegerFeedbackState);
} }
*buf += sizeof(xIntegerFeedbackState);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -295,39 +269,34 @@ CopySwapIntegerFeedback (client, i, buf) ...@@ -295,39 +269,34 @@ CopySwapIntegerFeedback (client, i, buf)
*/ */
void void
CopySwapStringFeedback (client, s, buf) CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
ClientPtr client; {
StringFeedbackPtr s;
char **buf;
{
int i; int i;
xStringFeedbackState *s2; xStringFeedbackState *s2;
KeySym *kptr; KeySym *kptr;
s2 = (xStringFeedbackState *) *buf; s2 = (xStringFeedbackState *) * buf;
s2->class = StringFeedbackClass; s2->class = StringFeedbackClass;
s2->length = sizeof (xStringFeedbackState) + s2->length = sizeof(xStringFeedbackState) +
s->ctrl.num_symbols_supported * sizeof (KeySym); s->ctrl.num_symbols_supported * sizeof(KeySym);
s2->id = s->ctrl.id; s2->id = s->ctrl.id;
s2->max_symbols = s->ctrl.max_symbols; s2->max_symbols = s->ctrl.max_symbols;
s2->num_syms_supported = s->ctrl.num_symbols_supported; s2->num_syms_supported = s->ctrl.num_symbols_supported;
*buf += sizeof (xStringFeedbackState); *buf += sizeof(xStringFeedbackState);
kptr = (KeySym *) (*buf); kptr = (KeySym *) (*buf);
for (i=0; i<s->ctrl.num_symbols_supported; i++) for (i = 0; i < s->ctrl.num_symbols_supported; i++)
*kptr++ = *(s->ctrl.symbols_supported+i); *kptr++ = *(s->ctrl.symbols_supported + i);
if (client->swapped) if (client->swapped) {
{
swaps(&s2->length); swaps(&s2->length);
swaps(&s2->max_symbols); swaps(&s2->max_symbols);
swaps(&s2->num_syms_supported); swaps(&s2->num_syms_supported);
kptr = (KeySym *) (*buf); kptr = (KeySym *) (*buf);
for (i=0; i<s->ctrl.num_symbols_supported; i++,kptr++) for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
{
swapl(kptr); swapl(kptr);
}
} }
*buf += (s->ctrl.num_symbols_supported * sizeof (KeySym));
} }
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
}
/*********************************************************************** /***********************************************************************
* *
...@@ -336,27 +305,23 @@ CopySwapStringFeedback (client, s, buf) ...@@ -336,27 +305,23 @@ CopySwapStringFeedback (client, s, buf)
*/ */
void void
CopySwapLedFeedback (client, l, buf) CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
ClientPtr client; {
LedFeedbackPtr l; xLedFeedbackState *l2;
char **buf;
{ l2 = (xLedFeedbackState *) * buf;
xLedFeedbackState *l2;
l2 = (xLedFeedbackState *) *buf;
l2->class = LedFeedbackClass; l2->class = LedFeedbackClass;
l2->length = sizeof (xLedFeedbackState); l2->length = sizeof(xLedFeedbackState);
l2->id = l->ctrl.id; l2->id = l->ctrl.id;
l2->led_values = l->ctrl.led_values; l2->led_values = l->ctrl.led_values;
l2->led_mask = l->ctrl.led_mask; l2->led_mask = l->ctrl.led_mask;
if (client->swapped) if (client->swapped) {
{
swaps(&l2->length); swaps(&l2->length);
swapl(&l2->led_values); swapl(&l2->led_values);
swapl(&l2->led_mask); swapl(&l2->led_mask);
}
*buf += sizeof (xLedFeedbackState);
} }
*buf += sizeof(xLedFeedbackState);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -365,28 +330,24 @@ CopySwapLedFeedback (client, l, buf) ...@@ -365,28 +330,24 @@ CopySwapLedFeedback (client, l, buf)
*/ */
void void
CopySwapBellFeedback (client, b, buf) CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
ClientPtr client; {
BellFeedbackPtr b; xBellFeedbackState *b2;
char **buf;
{ b2 = (xBellFeedbackState *) * buf;
xBellFeedbackState *b2;
b2 = (xBellFeedbackState *) *buf;
b2->class = BellFeedbackClass; b2->class = BellFeedbackClass;
b2->length = sizeof (xBellFeedbackState); b2->length = sizeof(xBellFeedbackState);
b2->id = b->ctrl.id; b2->id = b->ctrl.id;
b2->percent = b->ctrl.percent; b2->percent = b->ctrl.percent;
b2->pitch = b->ctrl.pitch; b2->pitch = b->ctrl.pitch;
b2->duration = b->ctrl.duration; b2->duration = b->ctrl.duration;
if (client->swapped) if (client->swapped) {
{
swaps(&b2->length); swaps(&b2->length);
swaps(&b2->pitch); swaps(&b2->pitch);
swaps(&b2->duration); swaps(&b2->duration);
}
*buf += sizeof (xBellFeedbackState);
} }
*buf += sizeof(xBellFeedbackState);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -396,13 +357,11 @@ CopySwapBellFeedback (client, b, buf) ...@@ -396,13 +357,11 @@ CopySwapBellFeedback (client, b, buf)
*/ */
void void
SRepXGetFeedbackControl (client, size, rep) SRepXGetFeedbackControl(ClientPtr client, int size,
ClientPtr client; xGetFeedbackControlReply * rep)
int size; {
xGetFeedbackControlReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
swaps(&rep->num_feedbacks); swaps(&rep->num_feedbacks);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,63 +30,45 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,63 +30,45 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFCTL_H #ifndef GETFCTL_H
#define GETFCTL_H 1 #define GETFCTL_H 1
int int SProcXGetFeedbackControl(ClientPtr /* client */
SProcXGetFeedbackControl( );
ClientPtr /* client */
); int ProcXGetFeedbackControl(ClientPtr /* client */
);
int
ProcXGetFeedbackControl( void CopySwapKbdFeedback(ClientPtr /* client */ ,
ClientPtr /* client */ KbdFeedbackPtr /* k */ ,
); char ** /* buf */
);
void
CopySwapKbdFeedback ( void CopySwapPtrFeedback(ClientPtr /* client */ ,
ClientPtr /* client */, PtrFeedbackPtr /* p */ ,
KbdFeedbackPtr /* k */, char ** /* buf */
char ** /* buf */ );
);
void CopySwapIntegerFeedback(ClientPtr /* client */ ,
void IntegerFeedbackPtr /* i */ ,
CopySwapPtrFeedback ( char ** /* buf */
ClientPtr /* client */, );
PtrFeedbackPtr /* p */,
char ** /* buf */ void CopySwapStringFeedback(ClientPtr /* client */ ,
); StringFeedbackPtr /* s */ ,
char ** /* buf */
void );
CopySwapIntegerFeedback (
ClientPtr /* client */, void CopySwapLedFeedback(ClientPtr /* client */ ,
IntegerFeedbackPtr /* i */, LedFeedbackPtr /* l */ ,
char ** /* buf */ char ** /* buf */
); );
void void CopySwapBellFeedback(ClientPtr /* client */ ,
CopySwapStringFeedback ( BellFeedbackPtr /* b */ ,
ClientPtr /* client */, char ** /* buf */
StringFeedbackPtr /* s */, );
char ** /* buf */
); void SRepXGetFeedbackControl(ClientPtr /* client */ ,
int /* size */ ,
void xGetFeedbackControlReply * /* rep */
CopySwapLedFeedback ( );
ClientPtr /* client */,
LedFeedbackPtr /* l */,
char ** /* buf */
);
void
CopySwapBellFeedback (
ClientPtr /* client */,
BellFeedbackPtr /* b */,
char ** /* buf */
);
void
SRepXGetFeedbackControl (
ClientPtr /* client */,
int /* size */,
xGetFeedbackControlReply * /* rep */
);
#endif /* GETFCTL_H */ #endif /* GETFCTL_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */ #include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "getfocus.h" #include "getfocus.h"
...@@ -74,13 +74,12 @@ SOFTWARE. ...@@ -74,13 +74,12 @@ SOFTWARE.
*/ */
int int
SProcXGetDeviceFocus(client) SProcXGetDeviceFocus(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceFocusReq); REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXGetDeviceFocus(client)); return (ProcXGetDeviceFocus(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -89,22 +88,20 @@ SProcXGetDeviceFocus(client) ...@@ -89,22 +88,20 @@ SProcXGetDeviceFocus(client)
*/ */
int int
ProcXGetDeviceFocus(client) ProcXGetDeviceFocus(ClientPtr client)
ClientPtr client; {
{ DeviceIntPtr dev;
DeviceIntPtr dev; FocusClassPtr focus;
FocusClassPtr focus;
xGetDeviceFocusReply rep; xGetDeviceFocusReply rep;
REQUEST(xGetDeviceFocusReq); REQUEST(xGetDeviceFocusReq);
REQUEST_SIZE_MATCH(xGetDeviceFocusReq); REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL || !dev->focus) if (dev == NULL || !dev->focus) {
{
SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice); SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus; rep.RepType = X_GetDeviceFocus;
...@@ -119,14 +116,14 @@ ProcXGetDeviceFocus(client) ...@@ -119,14 +116,14 @@ ProcXGetDeviceFocus(client)
rep.focus = PointerRoot; rep.focus = PointerRoot;
else if (focus->win == FollowKeyboardWin) else if (focus->win == FollowKeyboardWin)
rep.focus = FollowKeyboard; rep.focus = FollowKeyboard;
else else
rep.focus = focus->win->drawable.id; rep.focus = focus->win->drawable.id;
rep.time = focus->time.milliseconds; rep.time = focus->time.milliseconds;
rep.revertTo = focus->revert; rep.revertTo = focus->revert;
WriteReplyToClient (client, sizeof(xGetDeviceFocusReply), &rep); WriteReplyToClient(client, sizeof(xGetDeviceFocusReply), &rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -136,14 +133,11 @@ ProcXGetDeviceFocus(client) ...@@ -136,14 +133,11 @@ ProcXGetDeviceFocus(client)
*/ */
void void
SRepXGetDeviceFocus (client, size, rep) SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
ClientPtr client; {
int size;
xGetDeviceFocusReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
swapl(&rep->focus); swapl(&rep->focus);
swapl(&rep->time); swapl(&rep->time);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFOCUS_H #ifndef GETFOCUS_H
#define GETFOCUS_H 1 #define GETFOCUS_H 1
int int SProcXGetDeviceFocus(ClientPtr /* client */
SProcXGetDeviceFocus( );
ClientPtr /* client */
); int ProcXGetDeviceFocus(ClientPtr /* client */
);
int
ProcXGetDeviceFocus( void SRepXGetDeviceFocus(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetDeviceFocusReply * /* rep */
);
void
SRepXGetDeviceFocus (
ClientPtr /* client */,
int /* size */,
xGetDeviceFocusReply * /* rep */
);
#endif /* GETFOCUS_H */ #endif /* GETFOCUS_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "swaprep.h" #include "swaprep.h"
...@@ -75,13 +75,12 @@ SOFTWARE. ...@@ -75,13 +75,12 @@ SOFTWARE.
*/ */
int int
SProcXGetDeviceKeyMapping(client) SProcXGetDeviceKeyMapping(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceKeyMappingReq); REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXGetDeviceKeyMapping(client)); return (ProcXGetDeviceKeyMapping(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -90,65 +89,56 @@ SProcXGetDeviceKeyMapping(client) ...@@ -90,65 +89,56 @@ SProcXGetDeviceKeyMapping(client)
*/ */
int int
ProcXGetDeviceKeyMapping(client) ProcXGetDeviceKeyMapping(register ClientPtr client)
register ClientPtr client; {
{
xGetDeviceKeyMappingReply rep; xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev; DeviceIntPtr dev;
KeySymsPtr k; KeySymsPtr k;
REQUEST(xGetDeviceKeyMappingReq); REQUEST(xGetDeviceKeyMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq); REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
if (dev->key == NULL) if (dev->key == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch);
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
BadMatch);
return Success; return Success;
} }
k = &dev->key->curKeySyms; k = &dev->key->curKeySyms;
if ((stuff->firstKeyCode < k->minKeyCode) || if ((stuff->firstKeyCode < k->minKeyCode) ||
(stuff->firstKeyCode > k->maxKeyCode)) (stuff->firstKeyCode > k->maxKeyCode)) {
{
client->errorValue = stuff->firstKeyCode; client->errorValue = stuff->firstKeyCode;
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
BadValue);
return Success; return Success;
} }
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) {
{
client->errorValue = stuff->count; client->errorValue = stuff->count;
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0, SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
BadValue);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetDeviceKeyMapping; rep.RepType = X_GetDeviceKeyMapping;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = k->mapWidth; 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); WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient( WriteSwappedDataToClient(client,
client, k->mapWidth * stuff->count * sizeof(KeySym),
k->mapWidth * stuff->count * sizeof(KeySym), &k->map[(stuff->firstKeyCode - k->minKeyCode) *
&k->map[(stuff->firstKeyCode - k->minKeyCode) * k->mapWidth]);
k->mapWidth]);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -158,13 +148,10 @@ ProcXGetDeviceKeyMapping(client) ...@@ -158,13 +148,10 @@ ProcXGetDeviceKeyMapping(client)
*/ */
void void
SRepXGetDeviceKeyMapping (client, size, rep) SRepXGetDeviceKeyMapping(ClientPtr client, int size,
ClientPtr client; xGetDeviceKeyMappingReply * rep)
int size; {
xGetDeviceKeyMappingReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETKMAP_H #ifndef GETKMAP_H
#define GETKMAP_H 1 #define GETKMAP_H 1
int int SProcXGetDeviceKeyMapping(ClientPtr /* client */
SProcXGetDeviceKeyMapping( );
ClientPtr /* client */
); int ProcXGetDeviceKeyMapping(ClientPtr /* client */
);
int
ProcXGetDeviceKeyMapping( void SRepXGetDeviceKeyMapping(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetDeviceKeyMappingReply * /* rep */
);
void
SRepXGetDeviceKeyMapping (
ClientPtr /* client */,
int /* size */,
xGetDeviceKeyMappingReply * /* rep */
);
#endif /* GETKMAP_H */ #endif /* GETKMAP_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> /* Request macro */ #include <nx-X11/extensions/XIproto.h> /* Request macro */
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "getmmap.h" #include "getmmap.h"
...@@ -74,13 +74,12 @@ SOFTWARE. ...@@ -74,13 +74,12 @@ SOFTWARE.
*/ */
int int
SProcXGetDeviceModifierMapping(client) SProcXGetDeviceModifierMapping(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceModifierMappingReq); REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXGetDeviceModifierMapping(client)); return (ProcXGetDeviceModifierMapping(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -89,47 +88,44 @@ SProcXGetDeviceModifierMapping(client) ...@@ -89,47 +88,44 @@ SProcXGetDeviceModifierMapping(client)
*/ */
int int
ProcXGetDeviceModifierMapping(client) ProcXGetDeviceModifierMapping(ClientPtr client)
ClientPtr client; {
{ CARD8 maxkeys;
CARD8 maxkeys; DeviceIntPtr dev;
DeviceIntPtr dev; xGetDeviceModifierMappingReply rep;
xGetDeviceModifierMappingReply rep; KeyClassPtr kp;
KeyClassPtr kp;
REQUEST(xGetDeviceModifierMappingReq); REQUEST(xGetDeviceModifierMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq); REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
kp = dev->key; kp = dev->key;
if (kp == NULL) if (kp == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0, BadMatch);
BadMatch);
return Success; return Success;
} }
maxkeys = kp->maxKeysPerModifier; maxkeys = kp->maxKeysPerModifier;
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetDeviceModifierMapping; rep.RepType = X_GetDeviceModifierMapping;
rep.numKeyPerModifier = maxkeys; rep.numKeyPerModifier = maxkeys;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */ /* 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); WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
/* Reply with the (modified by DDX) map that SetModifierMapping passed in */ /* 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; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -139,12 +135,10 @@ ProcXGetDeviceModifierMapping(client) ...@@ -139,12 +135,10 @@ ProcXGetDeviceModifierMapping(client)
*/ */
void void
SRepXGetDeviceModifierMapping (client, size, rep) SRepXGetDeviceModifierMapping(ClientPtr client, int size,
ClientPtr client; xGetDeviceModifierMappingReply * rep)
int size; {
xGetDeviceModifierMappingReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETMMAP_H #ifndef GETMMAP_H
#define GETMMAP_H 1 #define GETMMAP_H 1
int int SProcXGetDeviceModifierMapping(ClientPtr /* client */
SProcXGetDeviceModifierMapping( );
ClientPtr /* client */
); int ProcXGetDeviceModifierMapping(ClientPtr /* client */
);
int
ProcXGetDeviceModifierMapping( void SRepXGetDeviceModifierMapping(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetDeviceModifierMappingReply * /* rep */
);
void
SRepXGetDeviceModifierMapping (
ClientPtr /* client */,
int /* size */,
xGetDeviceModifierMappingReply * /* rep */
);
#endif /* GETMMAP_H */ #endif /* GETMMAP_H */
...@@ -55,21 +55,21 @@ SOFTWARE. ...@@ -55,21 +55,21 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */ #include "windowstr.h" /* window structs */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "swaprep.h" #include "swaprep.h"
#include "getprop.h" #include "getprop.h"
extern XExtEventInfo EventInfo[]; extern XExtEventInfo EventInfo[];
extern int ExtEventIndex; extern int ExtEventIndex;
/*********************************************************************** /***********************************************************************
* *
...@@ -78,15 +78,14 @@ extern int ExtEventIndex; ...@@ -78,15 +78,14 @@ extern int ExtEventIndex;
*/ */
int int
SProcXGetDeviceDontPropagateList(client) SProcXGetDeviceDontPropagateList(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceDontPropagateListReq); REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window); swapl(&stuff->window);
return(ProcXGetDeviceDontPropagateList(client)); return (ProcXGetDeviceDontPropagateList(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -95,15 +94,14 @@ SProcXGetDeviceDontPropagateList(client) ...@@ -95,15 +94,14 @@ SProcXGetDeviceDontPropagateList(client)
*/ */
int int
ProcXGetDeviceDontPropagateList (client) ProcXGetDeviceDontPropagateList(register ClientPtr client)
register ClientPtr client; {
{ CARD16 count = 0;
CARD16 count = 0; int i;
int i; XEventClass *buf = NULL, *tbuf;
XEventClass *buf = NULL, *tbuf; WindowPtr pWin;
WindowPtr pWin; xGetDeviceDontPropagateListReply rep;
xGetDeviceDontPropagateListReply rep; OtherInputMasks *others;
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq); REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
...@@ -114,44 +112,39 @@ ProcXGetDeviceDontPropagateList (client) ...@@ -114,44 +112,39 @@ ProcXGetDeviceDontPropagateList (client)
rep.length = 0; rep.length = 0;
rep.count = 0; rep.count = 0;
pWin = (WindowPtr) LookupWindow (stuff->window, client); pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) if (!pWin) {
{
client->errorValue = stuff->window; client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
BadWindow); BadWindow);
return Success; return Success;
} }
if ((others = wOtherInputMasks(pWin)) != 0) if ((others = wOtherInputMasks(pWin)) != 0) {
{ for (i = 0; i < EMASKSIZE; i++)
for (i=0; i<EMASKSIZE; i++) tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i,
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i, &count, COUNT);
&count, COUNT); if (count) {
if (count)
{
rep.count = count; rep.count = count;
buf = (XEventClass *) malloc (rep.count * sizeof(XEventClass)); buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2; rep.length = (rep.count * sizeof(XEventClass) + 3) >> 2;
tbuf = buf; tbuf = buf;
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++)
tbuf = ClassFromMask (tbuf, others->dontPropagateMask[i], i, tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
NULL, CREATE); NULL, CREATE);
}
} }
}
WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply), WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
&rep);
if (count) if (count) {
{ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf); free(buf);
free (buf);
}
return Success;
} }
return Success;
}
/*********************************************************************** /***********************************************************************
* *
...@@ -161,31 +154,25 @@ ProcXGetDeviceDontPropagateList (client) ...@@ -161,31 +154,25 @@ ProcXGetDeviceDontPropagateList (client)
*/ */
XEventClass XEventClass
*ClassFromMask (buf, mask, maskndx, count, mode) * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 * count,
XEventClass *buf; int mode)
Mask mask; {
int maskndx; int i, j;
CARD16 *count; int id = maskndx;
int mode; Mask tmask = 0x80000000;
{
int i,j; for (i = 0; i < 32; i++, tmask >>= 1)
int id = maskndx; if (tmask & mask) {
Mask tmask = 0x80000000; for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].mask == tmask) {
for (i=0; i<32; i++,tmask>>=1)
if (tmask & mask)
{
for (j=0; j<ExtEventIndex; j++)
if (EventInfo[j].mask == tmask)
{
if (mode == COUNT) if (mode == COUNT)
(*count)++; (*count)++;
else else
*buf++ = (id << 8) | EventInfo[j].type; *buf++ = (id << 8) | EventInfo[j].type;
} }
} }
return (buf); return (buf);
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -195,13 +182,11 @@ XEventClass ...@@ -195,13 +182,11 @@ XEventClass
*/ */
void void
SRepXGetDeviceDontPropagateList (client, size, rep) SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
ClientPtr client; xGetDeviceDontPropagateListReply * rep)
int size; {
xGetDeviceDontPropagateListReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
swaps(&rep->count); swaps(&rep->count);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,30 +30,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,30 +30,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETPROP_H #ifndef GETPROP_H
#define GETPROP_H 1 #define GETPROP_H 1
int int SProcXGetDeviceDontPropagateList(ClientPtr /* client */
SProcXGetDeviceDontPropagateList( );
ClientPtr /* client */
); int ProcXGetDeviceDontPropagateList(ClientPtr /* client */
);
int
ProcXGetDeviceDontPropagateList ( XEventClass *ClassFromMask(XEventClass * /* buf */ ,
ClientPtr /* client */ Mask /* mask */ ,
); int /* maskndx */ ,
CARD16 * /* count */ ,
XEventClass * int /* mode */
ClassFromMask ( );
XEventClass * /* buf */,
Mask /* mask */, void SRepXGetDeviceDontPropagateList(ClientPtr /* client */ ,
int /* maskndx */, int /* size */ ,
CARD16 * /* count */, xGetDeviceDontPropagateListReply * /* rep */
int /* mode */ );
);
void
SRepXGetDeviceDontPropagateList (
ClientPtr /* client */,
int /* size */,
xGetDeviceDontPropagateListReply * /* rep */
);
#endif /* GETPROP_H */ #endif /* GETPROP_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */ #include "windowstr.h" /* window struct */
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "swaprep.h" #include "swaprep.h"
...@@ -76,15 +76,14 @@ SOFTWARE. ...@@ -76,15 +76,14 @@ SOFTWARE.
*/ */
int int
SProcXGetSelectedExtensionEvents(client) SProcXGetSelectedExtensionEvents(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetSelectedExtensionEventsReq); REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window); swapl(&stuff->window);
return(ProcXGetSelectedExtensionEvents(client)); return (ProcXGetSelectedExtensionEvents(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -94,18 +93,17 @@ SProcXGetSelectedExtensionEvents(client) ...@@ -94,18 +93,17 @@ SProcXGetSelectedExtensionEvents(client)
*/ */
int int
ProcXGetSelectedExtensionEvents(client) ProcXGetSelectedExtensionEvents(register ClientPtr client)
register ClientPtr client; {
{ int i;
int i; int total_length = 0;
int total_length = 0; xGetSelectedExtensionEventsReply rep;
xGetSelectedExtensionEventsReply rep; WindowPtr pWin;
WindowPtr pWin; XEventClass *buf = NULL;
XEventClass *buf = NULL; XEventClass *tclient;
XEventClass *tclient; XEventClass *aclient;
XEventClass *aclient; OtherInputMasks *pOthers;
OtherInputMasks *pOthers; InputClientsPtr others;
InputClientsPtr others;
REQUEST(xGetSelectedExtensionEventsReq); REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
...@@ -117,55 +115,53 @@ ProcXGetSelectedExtensionEvents(client) ...@@ -117,55 +115,53 @@ ProcXGetSelectedExtensionEvents(client)
rep.this_client_count = 0; rep.this_client_count = 0;
rep.all_clients_count = 0; rep.all_clients_count = 0;
if (!(pWin = LookupWindow(stuff->window, client))) if (!(pWin = LookupWindow(stuff->window, client))) {
{ SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0, BadWindow);
BadWindow);
return Success; return Success;
} }
if ((pOthers = wOtherInputMasks(pWin)) != 0) if ((pOthers = wOtherInputMasks(pWin)) != 0) {
{ for (others = pOthers->inputClients; others; others = others->next)
for (others = pOthers->inputClients; others; others=others->next) for (i = 0; i < EMASKSIZE; i++)
for (i=0; i<EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i,
tclient = ClassFromMask (NULL, others->mask[i], i, &rep.all_clients_count, COUNT);
&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)) {
if (SameClient(others, client)) for (i = 0; i < EMASKSIZE; i++)
{ tclient = ClassFromMask(NULL, others->mask[i], i,
for (i=0; i<EMASKSIZE; i++) &rep.this_client_count, COUNT);
tclient = ClassFromMask (NULL, others->mask[i], i,
&rep.this_client_count, COUNT);
break; break;
} }
total_length = (rep.all_clients_count + rep.this_client_count) * total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof (XEventClass); sizeof(XEventClass);
rep.length = (total_length + 3) >> 2; rep.length = (total_length + 3) >> 2;
buf = (XEventClass *) malloc (total_length); buf = (XEventClass *) malloc(total_length);
tclient = buf; tclient = buf;
aclient = buf + rep.this_client_count; aclient = buf + rep.this_client_count;
if (others) if (others)
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++)
tclient = ClassFromMask (tclient, others->mask[i], i, NULL, CREATE); 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)
aclient = ClassFromMask (aclient, others->mask[i], i, NULL, CREATE); 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) if (total_length) {
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient( client, total_length, buf); WriteSwappedDataToClient(client, total_length, buf);
free (buf); free(buf);
}
return Success;
} }
return Success;
}
/*********************************************************************** /***********************************************************************
* *
...@@ -175,14 +171,12 @@ ProcXGetSelectedExtensionEvents(client) ...@@ -175,14 +171,12 @@ ProcXGetSelectedExtensionEvents(client)
*/ */
void void
SRepXGetSelectedExtensionEvents (client, size, rep) SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
ClientPtr client; xGetSelectedExtensionEventsReply * rep)
int size; {
xGetSelectedExtensionEventsReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
swaps(&rep->this_client_count); swaps(&rep->this_client_count);
swaps(&rep->all_clients_count); swaps(&rep->all_clients_count);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETSELEV_H #ifndef GETSELEV_H
#define GETSELEV_H 1 #define GETSELEV_H 1
int int SProcXGetSelectedExtensionEvents(ClientPtr /* client */
SProcXGetSelectedExtensionEvents( );
ClientPtr /* client */
); int ProcXGetSelectedExtensionEvents(ClientPtr /* client */
);
int
ProcXGetSelectedExtensionEvents( void SRepXGetSelectedExtensionEvents(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetSelectedExtensionEventsReply * /* rep */
);
void
SRepXGetSelectedExtensionEvents (
ClientPtr /* client */,
int /* size */,
xGetSelectedExtensionEventsReply * /* rep */
);
#endif /* GETSELEV_H */ #endif /* GETSELEV_H */
...@@ -55,18 +55,18 @@ SOFTWARE. ...@@ -55,18 +55,18 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "getvers.h" #include "getvers.h"
XExtensionVersion AllExtensionVersions[128]; XExtensionVersion AllExtensionVersions[128];
/*********************************************************************** /***********************************************************************
* *
...@@ -75,15 +75,14 @@ XExtensionVersion AllExtensionVersions[128]; ...@@ -75,15 +75,14 @@ XExtensionVersion AllExtensionVersions[128];
*/ */
int int
SProcXGetExtensionVersion(client) SProcXGetExtensionVersion(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetExtensionVersionReq); REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq); REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes); swaps(&stuff->nbytes);
return(ProcXGetExtensionVersion(client)); return (ProcXGetExtensionVersion(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -92,21 +91,19 @@ SProcXGetExtensionVersion(client) ...@@ -92,21 +91,19 @@ SProcXGetExtensionVersion(client)
*/ */
int int
ProcXGetExtensionVersion (client) ProcXGetExtensionVersion(register ClientPtr client)
register ClientPtr client; {
{ xGetExtensionVersionReply rep;
xGetExtensionVersionReply rep;
REQUEST(xGetExtensionVersionReq); REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq); REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (stuff->length != (sizeof(xGetExtensionVersionReq) + if (stuff->length != (sizeof(xGetExtensionVersionReq) +
stuff->nbytes + 3)>>2) stuff->nbytes + 3) >> 2) {
{ SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0, BadLength);
BadLength);
return Success; return Success;
} }
memset(&rep, 0, sizeof(xGetExtensionVersionReply)); memset(&rep, 0, sizeof(xGetExtensionVersionReply));
rep.repType = X_Reply; rep.repType = X_Reply;
...@@ -117,17 +114,14 @@ ProcXGetExtensionVersion (client) ...@@ -117,17 +114,14 @@ ProcXGetExtensionVersion (client)
rep.minor_version = 0; rep.minor_version = 0;
rep.present = TRUE; rep.present = TRUE;
if (rep.present) if (rep.present) {
{ rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
rep.major_version = rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
AllExtensionVersions[IReqCode-128].major_version; }
rep.minor_version = WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
AllExtensionVersions[IReqCode-128].minor_version;
}
WriteReplyToClient (client, sizeof (xGetExtensionVersionReply), &rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -137,14 +131,12 @@ ProcXGetExtensionVersion (client) ...@@ -137,14 +131,12 @@ ProcXGetExtensionVersion (client)
*/ */
void void
SRepXGetExtensionVersion (client, size, rep) SRepXGetExtensionVersion(ClientPtr client, int size,
ClientPtr client; xGetExtensionVersionReply * rep)
int size; {
xGetExtensionVersionReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
swaps(&rep->major_version); swaps(&rep->major_version);
swaps(&rep->minor_version); swaps(&rep->minor_version);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETVERS_H #ifndef GETVERS_H
#define GETVERS_H 1 #define GETVERS_H 1
int int SProcXGetExtensionVersion(ClientPtr /* client */
SProcXGetExtensionVersion( );
ClientPtr /* client */
); int ProcXGetExtensionVersion(ClientPtr /* client */
);
int
ProcXGetExtensionVersion ( void SRepXGetExtensionVersion(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetExtensionVersionReply * /* rep */
);
void
SRepXGetExtensionVersion (
ClientPtr /* client */,
int /* size */,
xGetExtensionVersionReply * /* rep */
);
#endif /* GETVERS_H */ #endif /* GETVERS_H */
...@@ -51,26 +51,25 @@ SOFTWARE. ...@@ -51,26 +51,25 @@ SOFTWARE.
* *
*/ */
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "dixevents.h" /* GrabDevice */ #include "dixevents.h" /* GrabDevice */
#include "grabdev.h" #include "grabdev.h"
extern XExtEventInfo EventInfo[]; extern XExtEventInfo EventInfo[];
extern int ExtEventIndex; extern int ExtEventIndex;
/*********************************************************************** /***********************************************************************
* *
...@@ -79,9 +78,8 @@ extern int ExtEventIndex; ...@@ -79,9 +78,8 @@ extern int ExtEventIndex;
*/ */
int int
SProcXGrabDevice(client) SProcXGrabDevice(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGrabDeviceReq); REQUEST(xGrabDeviceReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
...@@ -94,8 +92,8 @@ SProcXGrabDevice(client) ...@@ -94,8 +92,8 @@ SProcXGrabDevice(client)
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDevice(client)); return (ProcXGrabDevice(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -104,52 +102,49 @@ SProcXGrabDevice(client) ...@@ -104,52 +102,49 @@ SProcXGrabDevice(client)
*/ */
int int
ProcXGrabDevice(client) ProcXGrabDevice(ClientPtr client)
ClientPtr client; {
{ int error;
int error; xGrabDeviceReply rep;
xGrabDeviceReply rep; DeviceIntPtr dev;
DeviceIntPtr dev; struct tmask tmp[EMASKSIZE];
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceReq); REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (stuff->length !=(sizeof(xGrabDeviceReq)>>2) + stuff->event_count) 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; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GrabDevice; rep.RepType = X_GrabDevice;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = 0; rep.length = 0;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice); SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
return Success; return Success;
} }
if (CreateMaskFromList (client, (XEventClass *)&stuff[1], if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->event_count, tmp, dev, X_GrabDevice) != Success) stuff->event_count, tmp, dev,
X_GrabDevice) != Success)
return 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->other_devices_mode, stuff->grabWindow,
stuff->time, tmp[stuff->deviceid].mask, &rep.status); stuff->ownerEvents, stuff->time,
tmp[stuff->deviceid].mask, &rep.status);
if (error != Success) if (error != Success) {
{
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error); SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
return Success; return Success;
} }
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep); WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -158,49 +153,39 @@ ProcXGrabDevice(client) ...@@ -158,49 +153,39 @@ ProcXGrabDevice(client)
*/ */
int int
CreateMaskFromList (client, list, count, mask, dev, req) CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
ClientPtr client; struct tmask *mask, DeviceIntPtr dev, int req)
XEventClass *list; {
int count; int i, j;
struct tmask mask[]; int device;
DeviceIntPtr dev; DeviceIntPtr tdev;
int req;
{ for (i = 0; i < EMASKSIZE; i++) {
int i,j;
int device;
DeviceIntPtr tdev;
for (i=0; i<EMASKSIZE; i++)
{
mask[i].mask = 0; mask[i].mask = 0;
mask[i].dev = NULL; mask[i].dev = NULL;
} }
for (i=0; i<count; i++, list++) for (i = 0; i < count; i++, list++) {
{
device = *list >> 8; device = *list >> 8;
if (device > 255) if (device > 255) {
{
SendErrorToClient(client, IReqCode, req, 0, BadClass); SendErrorToClient(client, IReqCode, req, 0, BadClass);
return BadClass; return BadClass;
} }
tdev = LookupDeviceIntRec (device); tdev = LookupDeviceIntRec(device);
if (tdev==NULL || (dev != NULL && tdev != dev)) if (tdev == NULL || (dev != NULL && tdev != dev)) {
{
SendErrorToClient(client, IReqCode, req, 0, BadClass); SendErrorToClient(client, IReqCode, req, 0, BadClass);
return BadClass; return BadClass;
} }
for (j=0; j<ExtEventIndex; j++) for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff)) if (EventInfo[j].type == (*list & 0xff)) {
{
mask[device].mask |= EventInfo[j].mask; mask[device].mask |= EventInfo[j].mask;
mask[device].dev = (Pointer) tdev; mask[device].dev = (Pointer) tdev;
break; break;
} }
}
return Success;
} }
return Success;
}
/*********************************************************************** /***********************************************************************
* *
...@@ -210,12 +195,9 @@ CreateMaskFromList (client, list, count, mask, dev, req) ...@@ -210,12 +195,9 @@ CreateMaskFromList (client, list, count, mask, dev, req)
*/ */
void void
SRepXGrabDevice (client, size, rep) SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
ClientPtr client; {
int size;
xGrabDeviceReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,31 +30,23 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,31 +30,23 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GRABDEV_H #ifndef GRABDEV_H
#define GRABDEV_H 1 #define GRABDEV_H 1
int int SProcXGrabDevice(ClientPtr /* client */
SProcXGrabDevice( );
ClientPtr /* client */
); int ProcXGrabDevice(ClientPtr /* client */
);
int
ProcXGrabDevice( int CreateMaskFromList(ClientPtr /* client */ ,
ClientPtr /* client */ XEventClass * /* list */ ,
); int /* count */ ,
struct tmask /* mask */ [],
int DeviceIntPtr /* dev */ ,
CreateMaskFromList ( int /* req */
ClientPtr /* client */, );
XEventClass * /* list */,
int /* count */, void SRepXGrabDevice(ClientPtr /* client */ ,
struct tmask /* mask */[], int /* size */ ,
DeviceIntPtr /* dev */, xGrabDeviceReply * /* rep */
int /* req */ );
);
void
SRepXGrabDevice (
ClientPtr /* client */,
int /* size */,
xGrabDeviceReply * /* rep */
);
#endif /* GRABDEV_H */ #endif /* GRABDEV_H */
...@@ -55,15 +55,15 @@ SOFTWARE. ...@@ -55,15 +55,15 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "exevents.h" #include "exevents.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "grabdev.h" #include "grabdev.h"
...@@ -76,9 +76,8 @@ SOFTWARE. ...@@ -76,9 +76,8 @@ SOFTWARE.
*/ */
int int
SProcXGrabDeviceButton(client) SProcXGrabDeviceButton(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGrabDeviceButtonReq); REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
...@@ -89,8 +88,8 @@ SProcXGrabDeviceButton(client) ...@@ -89,8 +88,8 @@ SProcXGrabDeviceButton(client)
stuff->event_count * sizeof(CARD32)); stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDeviceButton(client)); return (ProcXGrabDeviceButton(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -99,61 +98,55 @@ SProcXGrabDeviceButton(client) ...@@ -99,61 +98,55 @@ SProcXGrabDeviceButton(client)
*/ */
int int
ProcXGrabDeviceButton(client) ProcXGrabDeviceButton(ClientPtr client)
ClientPtr client; {
{ int ret;
int ret; DeviceIntPtr dev;
DeviceIntPtr dev; DeviceIntPtr mdev;
DeviceIntPtr mdev; XEventClass *class;
XEventClass *class; struct tmask tmp[EMASKSIZE];
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceButtonReq); REQUEST(xGrabDeviceButtonReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=(sizeof(xGrabDeviceButtonReq)>>2) + stuff->event_count) 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; return Success;
} }
dev = LookupDeviceIntRec (stuff->grabbed_device); dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadDevice);
return Success; return Success;
} }
if (stuff->modifier_device != UseXKeyboard) if (stuff->modifier_device != UseXKeyboard) {
{ mdev = LookupDeviceIntRec(stuff->modifier_device);
mdev = LookupDeviceIntRec (stuff->modifier_device); if (mdev == NULL) {
if (mdev == NULL) SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
{ BadDevice);
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadDevice);
return Success; return Success;
} }
if (mdev->key == NULL) if (mdev->key == NULL) {
{ SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadMatch);
BadMatch);
return Success; return Success;
}
} }
else } else
mdev = (DeviceIntPtr) LookupKeyboardDevice(); mdev = (DeviceIntPtr) LookupKeyboardDevice();
class = (XEventClass *) (&stuff[1]); /* first word of values */ 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) stuff->event_count, tmp, dev,
return Success; X_GrabDeviceButton)) != Success)
ret = GrabButton(client, dev, stuff->this_device_mode, return Success;
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button, ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0, stuff->other_devices_mode, stuff->modifiers, mdev,
tmp[stuff->grabbed_device].mask); stuff->button, stuff->grabWindow, stuff->ownerEvents,
(Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask);
if (ret != Success) if (ret != Success)
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret); SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
return(Success); return (Success);
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GRABDEVB_H #ifndef GRABDEVB_H
#define GRABDEVB_H 1 #define GRABDEVB_H 1
int int SProcXGrabDeviceButton(ClientPtr /* client */
SProcXGrabDeviceButton( );
ClientPtr /* client */
); int ProcXGrabDeviceButton(ClientPtr /* client */
);
int
ProcXGrabDeviceButton(
ClientPtr /* client */
);
#endif /* GRABDEVB_H */ #endif /* GRABDEVB_H */
...@@ -55,15 +55,15 @@ SOFTWARE. ...@@ -55,15 +55,15 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "exevents.h" #include "exevents.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "grabdev.h" #include "grabdev.h"
...@@ -76,9 +76,8 @@ SOFTWARE. ...@@ -76,9 +76,8 @@ SOFTWARE.
*/ */
int int
SProcXGrabDeviceKey(client) SProcXGrabDeviceKey(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGrabDeviceKeyReq); REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
...@@ -87,8 +86,8 @@ SProcXGrabDeviceKey(client) ...@@ -87,8 +86,8 @@ SProcXGrabDeviceKey(client)
swaps(&stuff->event_count); swaps(&stuff->event_count);
REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32)); REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return(ProcXGrabDeviceKey(client)); return (ProcXGrabDeviceKey(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -97,66 +96,57 @@ SProcXGrabDeviceKey(client) ...@@ -97,66 +96,57 @@ SProcXGrabDeviceKey(client)
*/ */
int int
ProcXGrabDeviceKey(client) ProcXGrabDeviceKey(ClientPtr client)
ClientPtr client; {
{ int ret;
int ret; DeviceIntPtr dev;
DeviceIntPtr dev; DeviceIntPtr mdev;
DeviceIntPtr mdev; XEventClass *class;
XEventClass *class; struct tmask tmp[EMASKSIZE];
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceKeyReq); REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (stuff->length !=(sizeof(xGrabDeviceKeyReq)>>2) + stuff->event_count) 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; return Success;
} }
dev = LookupDeviceIntRec (stuff->grabbed_device); dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
BadDevice);
return Success; return Success;
} }
if (stuff->modifier_device != UseXKeyboard) if (stuff->modifier_device != UseXKeyboard) {
{ mdev = LookupDeviceIntRec(stuff->modifier_device);
mdev = LookupDeviceIntRec (stuff->modifier_device); if (mdev == NULL) {
if (mdev == NULL) SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
{
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
BadDevice);
return Success; return Success;
} }
if (mdev->key == NULL) if (mdev->key == NULL) {
{ SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadMatch);
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
BadMatch);
return Success; return Success;
}
} }
else } else
mdev = (DeviceIntPtr) LookupKeyboardDevice(); mdev = (DeviceIntPtr) LookupKeyboardDevice();
class = (XEventClass *) (&stuff[1]); /* first word of values */ 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) stuff->event_count, tmp, dev,
return Success; X_GrabDeviceKey)) != 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->other_devices_mode, stuff->modifiers, mdev,
stuff->grabWindow, stuff->ownerEvents, tmp[stuff->grabbed_device].mask); stuff->key, stuff->grabWindow, stuff->ownerEvents,
tmp[stuff->grabbed_device].mask);
if (ret != Success) if (ret != Success) {
{
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret); SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
return Success; return Success;
} }
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GRABDEVK_H #ifndef GRABDEVK_H
#define GRABDEVK_H 1 #define GRABDEVK_H 1
int int SProcXGrabDeviceKey(ClientPtr /* client */
SProcXGrabDeviceKey( );
ClientPtr /* client */
); int ProcXGrabDeviceKey(ClientPtr /* client */
);
int
ProcXGrabDeviceKey(
ClientPtr /* client */
);
#endif /* GRABDEVK_H */ #endif /* GRABDEVK_H */
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
...@@ -74,16 +74,15 @@ SOFTWARE. ...@@ -74,16 +74,15 @@ SOFTWARE.
*/ */
int int
SProcXGetDeviceMotionEvents(client) SProcXGetDeviceMotionEvents(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xGetDeviceMotionEventsReq); REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start); swapl(&stuff->start);
swapl(&stuff->stop); swapl(&stuff->stop);
return(ProcXGetDeviceMotionEvents(client)); return (ProcXGetDeviceMotionEvents(client));
} }
/**************************************************************************** /****************************************************************************
* *
...@@ -92,36 +91,33 @@ register ClientPtr client; ...@@ -92,36 +91,33 @@ register ClientPtr client;
*/ */
int int
ProcXGetDeviceMotionEvents(client) ProcXGetDeviceMotionEvents(ClientPtr client)
ClientPtr client;
{ {
INT32 *coords = NULL, *bufptr; INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep; xGetDeviceMotionEventsReply rep;
unsigned long i; unsigned long i;
int num_events, axes, size = 0, tsize; int num_events, axes, size = 0, tsize;
unsigned long nEvents; unsigned long nEvents;
DeviceIntPtr dev; DeviceIntPtr dev;
TimeStamp start, stop; TimeStamp start, stop;
int length = 0; int length = 0;
ValuatorClassPtr v; ValuatorClassPtr v;
REQUEST(xGetDeviceMotionEventsReq); REQUEST(xGetDeviceMotionEventsReq);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
v = dev->valuator; v = dev->valuator;
if (v==NULL || v->numAxes == 0) if (v == NULL || v->numAxes == 0) {
{ SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadMatch);
BadMatch);
return Success; return Success;
} }
if (dev->valuator->motionHintWindow) if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client); MaybeStopDeviceHint(dev, client);
axes = v->numAxes; axes = v->numAxes;
...@@ -135,49 +131,43 @@ ProcXGetDeviceMotionEvents(client) ...@@ -135,49 +131,43 @@ ProcXGetDeviceMotionEvents(client)
start = ClientTimeToServerTime(stuff->start); start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop); stop = ClientTimeToServerTime(stuff->stop);
if (CompareTimeStamps(start, stop) == LATER || if (CompareTimeStamps(start, stop) == LATER ||
CompareTimeStamps(start, currentTime) == LATER) CompareTimeStamps(start, currentTime) == LATER) {
{ WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); return Success;
return Success; }
}
if (CompareTimeStamps(stop, currentTime) == LATER) if (CompareTimeStamps(stop, currentTime) == LATER)
stop = currentTime; stop = currentTime;
num_events = v->numMotionEvents; num_events = v->numMotionEvents;
if (num_events) if (num_events) {
{ size = sizeof(Time) + (axes * sizeof(INT32));
size = sizeof(Time) + (axes * sizeof (INT32));
tsize = num_events * size; tsize = num_events * size;
coords = (INT32 *) malloc(tsize); coords = (INT32 *) malloc(tsize);
if (!coords) if (!coords)
{ {
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadAlloc); BadAlloc);
return Success; 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;
} }
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;
}
nEvents = rep.nEvents; nEvents = rep.nEvents;
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
if (nEvents) if (nEvents) {
{ if (client->swapped) {
if (client->swapped)
{
bufptr = coords; bufptr = coords;
for (i=0; i<nEvents * (axes+1); i++) for (i = 0; i < nEvents * (axes + 1); i++) {
{
swapl(bufptr); swapl(bufptr);
bufptr++; bufptr++;
}
} }
}
WriteToClient(client, length * 4, coords); WriteToClient(client, length * 4, coords);
} }
if (coords) if (coords)
free(coords); free(coords);
return Success; return Success;
...@@ -191,13 +181,11 @@ ProcXGetDeviceMotionEvents(client) ...@@ -191,13 +181,11 @@ ProcXGetDeviceMotionEvents(client)
*/ */
void void
SRepXGetDeviceMotionEvents (client, size, rep) SRepXGetDeviceMotionEvents(ClientPtr client, int size,
ClientPtr client; xGetDeviceMotionEventsReply * rep)
int size; {
xGetDeviceMotionEventsReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
swapl(&rep->nEvents); swapl(&rep->nEvents);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GTMOTION_H #ifndef GTMOTION_H
#define GTMOTION_H 1 #define GTMOTION_H 1
int int SProcXGetDeviceMotionEvents(ClientPtr /* client */
SProcXGetDeviceMotionEvents( );
ClientPtr /* client */
); int ProcXGetDeviceMotionEvents(ClientPtr /* client */
);
int
ProcXGetDeviceMotionEvents( void SRepXGetDeviceMotionEvents(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xGetDeviceMotionEventsReply * /* rep */
);
void
SRepXGetDeviceMotionEvents (
ClientPtr /* client */,
int /* size */,
xGetDeviceMotionEventsReply * /* rep */
);
#endif /* GTMOTION_H */ #endif /* GTMOTION_H */
...@@ -55,19 +55,19 @@ SOFTWARE. ...@@ -55,19 +55,19 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" /* FIXME */ #include "exglobals.h" /* FIXME */
#include "listdev.h" #include "listdev.h"
#define VPC 20 /* Max # valuators per chunk */ #define VPC 20 /* Max # valuators per chunk */
/*********************************************************************** /***********************************************************************
* *
...@@ -76,13 +76,12 @@ SOFTWARE. ...@@ -76,13 +76,12 @@ SOFTWARE.
*/ */
int int
SProcXListInputDevices(client) SProcXListInputDevices(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xListInputDevicesReq); REQUEST(xListInputDevicesReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXListInputDevices(client)); return (ProcXListInputDevices(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -91,20 +90,19 @@ SProcXListInputDevices(client) ...@@ -91,20 +90,19 @@ SProcXListInputDevices(client)
*/ */
int int
ProcXListInputDevices (client) ProcXListInputDevices(register ClientPtr client)
register ClientPtr client; {
{ xListInputDevicesReply rep;
xListInputDevicesReply rep; int numdevs;
int numdevs; int namesize = 1; /* need 1 extra byte for strcpy */
int namesize = 1; /* need 1 extra byte for strcpy */ int size = 0;
int size = 0; int total_length;
int total_length; char *devbuf;
char *devbuf; char *classbuf;
char *classbuf; char *namebuf;
char *namebuf; char *savbuf;
char *savbuf; xDeviceInfo *dev;
xDeviceInfo *dev; DeviceIntPtr d;
DeviceIntPtr d;
REQUEST_SIZE_MATCH(xListInputDevicesReq); REQUEST_SIZE_MATCH(xListInputDevicesReq);
...@@ -114,33 +112,33 @@ ProcXListInputDevices (client) ...@@ -114,33 +112,33 @@ ProcXListInputDevices (client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
AddOtherInputDevices (); AddOtherInputDevices();
numdevs = inputInfo.numDevices; numdevs = inputInfo.numDevices;
for (d=inputInfo.devices; d; d=d->next) for (d = inputInfo.devices; d; d = d->next)
SizeDeviceInfo (d, &namesize, &size); SizeDeviceInfo(d, &namesize, &size);
for (d=inputInfo.off_devices; d; d=d->next) for (d = inputInfo.off_devices; d; d = d->next)
SizeDeviceInfo (d, &namesize, &size); SizeDeviceInfo(d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize; total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *) calloc (1, total_length); devbuf = (char *) calloc (1, total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo)); classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
namebuf = classbuf + size; namebuf = classbuf + size;
savbuf = devbuf; savbuf = devbuf;
dev = (xDeviceInfoPtr) devbuf; dev = (xDeviceInfoPtr) devbuf;
for (d=inputInfo.devices; d; d=d->next,dev++) for (d = inputInfo.devices; d; d = d->next, dev++)
ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf); ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
for (d=inputInfo.off_devices; d; d=d->next,dev++) for (d = inputInfo.off_devices; d; d = d->next, dev++)
ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf); ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
rep.ndevices = numdevs; rep.ndevices = numdevs;
rep.length = (total_length + 3) >> 2; rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep); WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
free (savbuf); free(savbuf);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -150,27 +148,23 @@ ProcXListInputDevices (client) ...@@ -150,27 +148,23 @@ ProcXListInputDevices (client)
*/ */
void void
SizeDeviceInfo (d, namesize, size) SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
DeviceIntPtr d; {
int *namesize;
int *size;
{
int chunks; int chunks;
*namesize += 1; *namesize += 1;
if (d->name) if (d->name)
*namesize += strlen (d->name); *namesize += strlen(d->name);
if (d->key != NULL) if (d->key != NULL)
*size += sizeof (xKeyInfo); *size += sizeof(xKeyInfo);
if (d->button != NULL) if (d->button != NULL)
*size += sizeof (xButtonInfo); *size += sizeof(xButtonInfo);
if (d->valuator != NULL) if (d->valuator != NULL) {
{ chunks = ((int)d->valuator->numAxes + 19) / VPC;
chunks = ((int) d->valuator->numAxes + 19) / VPC; *size += (chunks * sizeof(xValuatorInfo) +
*size += (chunks * sizeof(xValuatorInfo) + d->valuator->numAxes * sizeof(xAxisInfo));
d->valuator->numAxes * sizeof(xAxisInfo));
}
} }
}
/*********************************************************************** /***********************************************************************
* *
...@@ -179,31 +173,24 @@ SizeDeviceInfo (d, namesize, size) ...@@ -179,31 +173,24 @@ SizeDeviceInfo (d, namesize, size)
*/ */
void void
ListDeviceInfo (client, d, dev, devbuf, classbuf, namebuf) ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
ClientPtr client; char **devbuf, char **classbuf, char **namebuf)
DeviceIntPtr d; {
xDeviceInfoPtr dev; CopyDeviceName(namebuf, d->name);
char **devbuf; CopySwapDevice(client, d, 0, devbuf);
char **classbuf; if (d->key != NULL) {
char **namebuf;
{
CopyDeviceName (namebuf, d->name);
CopySwapDevice (client, d, 0, devbuf);
if (d->key != NULL)
{
CopySwapKeyClass(client, d->key, classbuf); CopySwapKeyClass(client, d->key, classbuf);
dev->num_classes++; dev->num_classes++;
} }
if (d->button != NULL) if (d->button != NULL) {
{
CopySwapButtonClass(client, d->button, classbuf); CopySwapButtonClass(client, d->button, classbuf);
dev->num_classes++; dev->num_classes++;
}
if (d->valuator != NULL)
{
dev->num_classes += CopySwapValuatorClass(client, d->valuator, classbuf);
}
} }
if (d->valuator != NULL) {
dev->num_classes +=
CopySwapValuatorClass(client, d->valuator, classbuf);
}
}
/*********************************************************************** /***********************************************************************
* *
...@@ -216,24 +203,19 @@ ListDeviceInfo (client, d, dev, devbuf, classbuf, namebuf) ...@@ -216,24 +203,19 @@ ListDeviceInfo (client, d, dev, devbuf, classbuf, namebuf)
*/ */
void void
CopyDeviceName (namebuf, name) CopyDeviceName(char **namebuf, char *name)
char **namebuf; {
char *name; char *nameptr = (char *)*namebuf;
{
char *nameptr = (char *) *namebuf; if (name) {
*nameptr++ = strlen(name);
if (name) strcpy(nameptr, name);
{ *namebuf += (strlen(name) + 1);
*nameptr++ = strlen (name); } else {
strcpy (nameptr, name);
*namebuf += (strlen (name)+1);
}
else
{
*nameptr++ = 0; *nameptr++ = 0;
*namebuf += 1; *namebuf += 1;
}
} }
}
/*********************************************************************** /***********************************************************************
* *
...@@ -242,15 +224,12 @@ CopyDeviceName (namebuf, name) ...@@ -242,15 +224,12 @@ CopyDeviceName (namebuf, name)
*/ */
void void
CopySwapDevice (client, d, num_classes, buf) CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
register ClientPtr client; char **buf)
DeviceIntPtr d; {
int num_classes;
char **buf;
{
xDeviceInfoPtr dev; xDeviceInfoPtr dev;
dev = (xDeviceInfoPtr) *buf; dev = (xDeviceInfoPtr) * buf;
dev->id = d->id; dev->id = d->id;
dev->type = d->type; dev->type = d->type;
...@@ -261,12 +240,11 @@ CopySwapDevice (client, d, num_classes, buf) ...@@ -261,12 +240,11 @@ CopySwapDevice (client, d, num_classes, buf)
dev->use = IsXPointer; dev->use = IsXPointer;
else else
dev->use = IsXExtensionDevice; dev->use = IsXExtensionDevice;
if (client->swapped) if (client->swapped) {
{
swapl(&dev->type); /* macro - braces are required */ swapl(&dev->type); /* macro - braces are required */
}
*buf += sizeof (xDeviceInfo);
} }
*buf += sizeof(xDeviceInfo);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -275,25 +253,21 @@ CopySwapDevice (client, d, num_classes, buf) ...@@ -275,25 +253,21 @@ CopySwapDevice (client, d, num_classes, buf)
*/ */
void void
CopySwapKeyClass (client, k, buf) CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf)
register ClientPtr client; {
KeyClassPtr k; xKeyInfoPtr k2;
char **buf;
{ k2 = (xKeyInfoPtr) * buf;
xKeyInfoPtr k2;
k2 = (xKeyInfoPtr) *buf;
k2->class = KeyClass; k2->class = KeyClass;
k2->length = sizeof (xKeyInfo); k2->length = sizeof(xKeyInfo);
k2->min_keycode = k->curKeySyms.minKeyCode; k2->min_keycode = k->curKeySyms.minKeyCode;
k2->max_keycode = k->curKeySyms.maxKeyCode; k2->max_keycode = k->curKeySyms.maxKeyCode;
k2->num_keys = k2->max_keycode - k2->min_keycode + 1; k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
if (client->swapped) if (client->swapped) {
{
swaps(&k2->num_keys); swaps(&k2->num_keys);
}
*buf += sizeof (xKeyInfo);
} }
*buf += sizeof(xKeyInfo);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -302,23 +276,19 @@ CopySwapKeyClass (client, k, buf) ...@@ -302,23 +276,19 @@ CopySwapKeyClass (client, k, buf)
*/ */
void void
CopySwapButtonClass (client, b, buf) CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf)
register ClientPtr client; {
ButtonClassPtr b; xButtonInfoPtr b2;
char **buf;
{ b2 = (xButtonInfoPtr) * buf;
xButtonInfoPtr b2;
b2 = (xButtonInfoPtr) *buf;
b2->class = ButtonClass; b2->class = ButtonClass;
b2->length = sizeof (xButtonInfo); b2->length = sizeof(xButtonInfo);
b2->num_buttons = b->numButtons; b2->num_buttons = b->numButtons;
if (client->swapped) if (client->swapped) {
{
swaps(&b2->num_buttons); /* macro - braces are required */ swaps(&b2->num_buttons); /* macro - braces are required */
}
*buf += sizeof (xButtonInfo);
} }
*buf += sizeof(xButtonInfo);
}
/*********************************************************************** /***********************************************************************
* *
...@@ -333,34 +303,31 @@ CopySwapButtonClass (client, b, buf) ...@@ -333,34 +303,31 @@ CopySwapButtonClass (client, b, buf)
*/ */
int int
CopySwapValuatorClass (client, v, buf) CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf)
register ClientPtr client;
ValuatorClassPtr v;
char **buf;
{ {
int i, j, axes, t_axes; int i, j, axes, t_axes;
xValuatorInfoPtr v2; xValuatorInfoPtr v2;
AxisInfo *a; AxisInfo *a;
xAxisInfoPtr a2; xAxisInfoPtr a2;
for (i=0,axes=v->numAxes; i < ((v->numAxes+19)/VPC); i++, axes-=VPC) { for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC);
i++, axes -= VPC) {
t_axes = axes < VPC ? axes : VPC; t_axes = axes < VPC ? axes : VPC;
if (t_axes < 0) if (t_axes < 0)
t_axes = v->numAxes % VPC; t_axes = v->numAxes % VPC;
v2 = (xValuatorInfoPtr) *buf; v2 = (xValuatorInfoPtr) * buf;
v2->class = ValuatorClass; v2->class = ValuatorClass;
v2->length = sizeof (xValuatorInfo) + t_axes * sizeof (xAxisInfo); v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
v2->num_axes = t_axes; v2->num_axes = t_axes;
v2->mode = v->mode & DeviceMode; v2->mode = v->mode & DeviceMode;
v2->motion_buffer_size = v->numMotionEvents; v2->motion_buffer_size = v->numMotionEvents;
if (client->swapped) if (client->swapped) {
{
swapl(&v2->motion_buffer_size); swapl(&v2->motion_buffer_size);
} }
*buf += sizeof (xValuatorInfo); *buf += sizeof(xValuatorInfo);
a = v->axes + (VPC * i); a = v->axes + (VPC * i);
a2 = (xAxisInfoPtr) *buf; a2 = (xAxisInfoPtr) * buf;
for (j=0; j<t_axes; j++) { for (j = 0; j < t_axes; j++) {
a2->min_value = a->min_value; a2->min_value = a->min_value;
a2->max_value = a->max_value; a2->max_value = a->max_value;
a2->resolution = a->resolution; a2->resolution = a->resolution;
...@@ -371,7 +338,7 @@ CopySwapValuatorClass (client, v, buf) ...@@ -371,7 +338,7 @@ CopySwapValuatorClass (client, v, buf)
} }
a2++; a2++;
a++; a++;
*buf += sizeof (xAxisInfo); *buf += sizeof(xAxisInfo);
} }
} }
return (i); return (i);
...@@ -385,12 +352,9 @@ CopySwapValuatorClass (client, v, buf) ...@@ -385,12 +352,9 @@ CopySwapValuatorClass (client, v, buf)
*/ */
void void
SRepXListInputDevices (client, size, rep) SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
ClientPtr client; {
int size;
xListInputDevicesReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,73 +30,53 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,73 +30,53 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef LISTDEV_H #ifndef LISTDEV_H
#define LISTDEV_H 1 #define LISTDEV_H 1
int int SProcXListInputDevices(ClientPtr /* client */
SProcXListInputDevices( );
ClientPtr /* client */
); int ProcXListInputDevices(ClientPtr /* client */
);
int
ProcXListInputDevices ( void SizeDeviceInfo(DeviceIntPtr /* d */ ,
ClientPtr /* client */ int * /* namesize */ ,
); int * /* size */
);
void
SizeDeviceInfo ( void ListDeviceInfo(ClientPtr /* client */ ,
DeviceIntPtr /* d */, DeviceIntPtr /* d */ ,
int * /* namesize */, xDeviceInfoPtr /* dev */ ,
int * /* size */ char ** /* devbuf */ ,
); char ** /* classbuf */ ,
char ** /* namebuf */
void );
ListDeviceInfo (
ClientPtr /* client */, void CopyDeviceName(char ** /* namebuf */ ,
DeviceIntPtr /* d */, char * /* name */
xDeviceInfoPtr /* dev */, );
char ** /* devbuf */,
char ** /* classbuf */, void CopySwapDevice(ClientPtr /* client */ ,
char ** /* namebuf */ DeviceIntPtr /* d */ ,
); int /* num_classes */ ,
char ** /* buf */
void );
CopyDeviceName (
char ** /* namebuf */, void CopySwapKeyClass(ClientPtr /* client */ ,
char * /* name */ KeyClassPtr /* k */ ,
); char ** /* buf */
);
void
CopySwapDevice ( void CopySwapButtonClass(ClientPtr /* client */ ,
ClientPtr /* client */, ButtonClassPtr /* b */ ,
DeviceIntPtr /* d */, char ** /* buf */
int /* num_classes */, );
char ** /* buf */
); int CopySwapValuatorClass(ClientPtr /* client */ ,
ValuatorClassPtr /* v */ ,
void char ** /* buf */
CopySwapKeyClass ( );
ClientPtr /* client */,
KeyClassPtr /* k */, void SRepXListInputDevices(ClientPtr /* client */ ,
char ** /* buf */ int /* size */ ,
); xListInputDevicesReply * /* rep */
);
void
CopySwapButtonClass (
ClientPtr /* client */,
ButtonClassPtr /* b */,
char ** /* buf */
);
int
CopySwapValuatorClass (
ClientPtr /* client */,
ValuatorClassPtr /* v */,
char ** /* buf */
);
void
SRepXListInputDevices (
ClientPtr /* client */,
int /* size */,
xListInputDevicesReply * /* rep */
);
#endif /* LISTDEV_H */ #endif /* LISTDEV_H */
...@@ -55,20 +55,20 @@ SOFTWARE. ...@@ -55,20 +55,20 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "opendev.h" #include "opendev.h"
extern CARD8 event_base []; extern CARD8 event_base[];
/*********************************************************************** /***********************************************************************
* *
...@@ -78,13 +78,12 @@ extern CARD8 event_base []; ...@@ -78,13 +78,12 @@ extern CARD8 event_base [];
*/ */
int int
SProcXOpenDevice(client) SProcXOpenDevice(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xOpenDeviceReq); REQUEST(xOpenDeviceReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXOpenDevice(client)); return (ProcXOpenDevice(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -93,45 +92,40 @@ SProcXOpenDevice(client) ...@@ -93,45 +92,40 @@ SProcXOpenDevice(client)
*/ */
int int
ProcXOpenDevice(client) ProcXOpenDevice(register ClientPtr client)
register ClientPtr client; {
{ xInputClassInfo evbase[numInputClasses];
xInputClassInfo evbase [numInputClasses];
Bool enableit = FALSE; Bool enableit = FALSE;
int j=0; int j = 0;
int status = Success; int status = Success;
xOpenDeviceReply rep; xOpenDeviceReply rep;
DeviceIntPtr dev; DeviceIntPtr dev;
REQUEST(xOpenDeviceReq); REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq); REQUEST_SIZE_MATCH(xOpenDeviceReq);
if (stuff->deviceid == inputInfo.pointer->id || if (stuff->deviceid == inputInfo.pointer->id ||
stuff->deviceid == inputInfo.keyboard->id) stuff->deviceid == inputInfo.keyboard->id) {
{
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice); SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success; return Success;
} }
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) /* not open */ 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) if (dev->id == stuff->deviceid)
break; break;
if (dev == NULL) if (dev == NULL) {
{
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice); SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success; return Success;
}
enableit = TRUE;
} }
enableit = TRUE;
}
OpenInputDevice (dev, client, &status); OpenInputDevice(dev, client, &status);
if (status != Success) if (status != Success) {
{
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status); SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
return Success; return Success;
} }
if (enableit && dev->inited && dev->startup) if (enableit && dev->inited && dev->startup)
(void)EnableDevice(dev); (void)EnableDevice(dev);
...@@ -139,45 +133,39 @@ ProcXOpenDevice(client) ...@@ -139,45 +133,39 @@ ProcXOpenDevice(client)
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_OpenDevice; rep.RepType = X_OpenDevice;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
if (dev->key != NULL) if (dev->key != NULL) {
{
evbase[j].class = KeyClass; evbase[j].class = KeyClass;
evbase[j++].event_type_base = event_base[KeyClass]; evbase[j++].event_type_base = event_base[KeyClass];
} }
if (dev->button != NULL) if (dev->button != NULL) {
{
evbase[j].class = ButtonClass; evbase[j].class = ButtonClass;
evbase[j++].event_type_base = event_base[ButtonClass]; evbase[j++].event_type_base = event_base[ButtonClass];
} }
if (dev->valuator != NULL) if (dev->valuator != NULL) {
{
evbase[j].class = ValuatorClass; evbase[j].class = ValuatorClass;
evbase[j++].event_type_base = event_base[ValuatorClass]; evbase[j++].event_type_base = event_base[ValuatorClass];
} }
if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL || if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) {
{
evbase[j].class = FeedbackClass; evbase[j].class = FeedbackClass;
evbase[j++].event_type_base = event_base[FeedbackClass]; evbase[j++].event_type_base = event_base[FeedbackClass];
} }
if (dev->focus != NULL) if (dev->focus != NULL) {
{
evbase[j].class = FocusClass; evbase[j].class = FocusClass;
evbase[j++].event_type_base = event_base[FocusClass]; evbase[j++].event_type_base = event_base[FocusClass];
} }
if (dev->proximity != NULL) if (dev->proximity != NULL) {
{
evbase[j].class = ProximityClass; evbase[j].class = ProximityClass;
evbase[j++].event_type_base = event_base[ProximityClass]; evbase[j++].event_type_base = event_base[ProximityClass];
} }
evbase[j].class = OtherClass; evbase[j].class = OtherClass;
evbase[j++].event_type_base = event_base[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; rep.num_classes = j;
WriteReplyToClient (client, sizeof (xOpenDeviceReply), &rep); WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
WriteToClient(client, j * sizeof (xInputClassInfo), evbase); WriteToClient(client, j * sizeof (xInputClassInfo), evbase);
return (Success); return (Success);
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -187,12 +175,9 @@ ProcXOpenDevice(client) ...@@ -187,12 +175,9 @@ ProcXOpenDevice(client)
*/ */
void void
SRepXOpenDevice (client, size, rep) SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
ClientPtr client; {
int size;
xOpenDeviceReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef OPENDEV_H #ifndef OPENDEV_H
#define OPENDEV_H 1 #define OPENDEV_H 1
int int SProcXOpenDevice(ClientPtr /* client */
SProcXOpenDevice( );
ClientPtr /* client */
); int ProcXOpenDevice(ClientPtr /* client */
);
int
ProcXOpenDevice( void SRepXOpenDevice(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xOpenDeviceReply * /* rep */
);
void
SRepXOpenDevice (
ClientPtr /* client */,
int /* size */,
xOpenDeviceReply * /* rep */
);
#endif /* OPENDEV_H */ #endif /* OPENDEV_H */
...@@ -36,14 +36,14 @@ from The Open Group. ...@@ -36,14 +36,14 @@ from The Open Group.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
...@@ -56,13 +56,12 @@ from The Open Group. ...@@ -56,13 +56,12 @@ from The Open Group.
*/ */
int int
SProcXQueryDeviceState(client) SProcXQueryDeviceState(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xQueryDeviceStateReq); REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXQueryDeviceState(client)); return (ProcXQueryDeviceState(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -71,22 +70,21 @@ SProcXQueryDeviceState(client) ...@@ -71,22 +70,21 @@ SProcXQueryDeviceState(client)
*/ */
int int
ProcXQueryDeviceState(client) ProcXQueryDeviceState(register ClientPtr client)
register ClientPtr client; {
{ int i;
int i; int num_classes = 0;
int num_classes = 0; int total_length = 0;
int total_length = 0; char *buf, *savbuf;
char *buf, *savbuf; KeyClassPtr k;
KeyClassPtr k; xKeyState *tk;
xKeyState *tk; ButtonClassPtr b;
ButtonClassPtr b; xButtonState *tb;
xButtonState *tb; ValuatorClassPtr v;
ValuatorClassPtr v; xValuatorState *tv;
xValuatorState *tv; xQueryDeviceStateReply rep;
xQueryDeviceStateReply rep; DeviceIntPtr dev;
DeviceIntPtr dev; int *values;
int *values;
REQUEST(xQueryDeviceStateReq); REQUEST(xQueryDeviceStateReq);
REQUEST_SIZE_MATCH(xQueryDeviceStateReq); REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
...@@ -96,96 +94,83 @@ ProcXQueryDeviceState(client) ...@@ -96,96 +94,83 @@ ProcXQueryDeviceState(client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
BadDevice);
return Success; return Success;
} }
v = dev->valuator; v = dev->valuator;
if (v != NULL && v->motionHintWindow != NULL) if (v != NULL && v->motionHintWindow != NULL)
MaybeStopDeviceHint(dev, client); MaybeStopDeviceHint(dev, client);
k = dev->key; k = dev->key;
if (k != NULL) if (k != NULL) {
{ total_length += sizeof(xKeyState);
total_length += sizeof (xKeyState);
num_classes++; num_classes++;
} }
b = dev->button; b = dev->button;
if (b != NULL) if (b != NULL) {
{ total_length += sizeof(xButtonState);
total_length += sizeof (xButtonState);
num_classes++; num_classes++;
} }
if (v != NULL) if (v != NULL) {
{ total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
total_length += (sizeof(xValuatorState) +
(v->numAxes * sizeof(int)));
num_classes++; num_classes++;
} }
buf = (char *) malloc (total_length); buf = (char *)malloc(total_length);
if (!buf) if (!buf) {
{ SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc);
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
BadAlloc);
return Success; return Success;
} }
savbuf = buf; savbuf = buf;
if (k != NULL) if (k != NULL) {
{
tk = (xKeyState *) buf; tk = (xKeyState *) buf;
tk->class = KeyClass; tk->class = KeyClass;
tk->length = sizeof (xKeyState); tk->length = sizeof(xKeyState);
tk->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1; 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]; tk->keys[i] = k->down[i];
buf += sizeof (xKeyState); buf += sizeof(xKeyState);
} }
if (b != NULL) if (b != NULL) {
{
tb = (xButtonState *) buf; tb = (xButtonState *) buf;
tb->class = ButtonClass; tb->class = ButtonClass;
tb->length = sizeof (xButtonState); tb->length = sizeof(xButtonState);
tb->num_buttons = b->numButtons; tb->num_buttons = b->numButtons;
for (i = 0; i<32; i++) for (i = 0; i < 32; i++)
tb->buttons[i] = b->down[i]; tb->buttons[i] = b->down[i];
buf += sizeof (xButtonState); buf += sizeof(xButtonState);
} }
if (v != NULL) if (v != NULL) {
{
tv = (xValuatorState *) buf; tv = (xValuatorState *) buf;
tv->class = ValuatorClass; tv->class = ValuatorClass;
tv->length = sizeof (xValuatorState); tv->length = sizeof(xValuatorState);
tv->num_valuators = v->numAxes; tv->num_valuators = v->numAxes;
tv->mode = v->mode; tv->mode = v->mode;
buf += sizeof(xValuatorState); buf += sizeof(xValuatorState);
for (i=0, values=v->axisVal; i<v->numAxes; i++) for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
{ *((int *)buf) = *values++;
*((int *) buf) = *values++; if (client->swapped) {
if (client->swapped) swapl((int *)buf); /* macro - braces needed */
{
swapl ((int *) buf);/* macro - braces needed */
}
buf += sizeof(int);
} }
buf += sizeof(int);
} }
}
rep.num_classes = num_classes; rep.num_classes = num_classes;
rep.length = (total_length + 3) >> 2; rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep); WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0) if (total_length > 0)
WriteToClient (client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
free (savbuf); free(savbuf);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -195,12 +180,9 @@ ProcXQueryDeviceState(client) ...@@ -195,12 +180,9 @@ ProcXQueryDeviceState(client)
*/ */
void void
SRepXQueryDeviceState (client, size, rep) SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
ClientPtr client; {
int size;
xQueryDeviceStateReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef QUERYST_H #ifndef QUERYST_H
#define QUERYST_H 1 #define QUERYST_H 1
int int SProcXQueryDeviceState(ClientPtr /* client */
SProcXQueryDeviceState( );
ClientPtr /* client */
); int ProcXQueryDeviceState(ClientPtr /* client */
);
int
ProcXQueryDeviceState( void SRepXQueryDeviceState(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xQueryDeviceStateReply * /* rep */
);
void
SRepXQueryDeviceState (
ClientPtr /* client */,
int /* size */,
xQueryDeviceStateReply * /* rep */
);
#endif /* QUERYST_H */ #endif /* QUERYST_H */
...@@ -51,26 +51,27 @@ SOFTWARE. ...@@ -51,26 +51,27 @@ SOFTWARE.
* *
*/ */
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
#include "grabdev.h" #include "grabdev.h"
#include "selectev.h" #include "selectev.h"
extern Mask ExtExclusiveMasks[]; extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[]; extern Mask ExtValidMasks[];
/*********************************************************************** /***********************************************************************
* *
...@@ -79,9 +80,8 @@ extern Mask ExtValidMasks[]; ...@@ -79,9 +80,8 @@ extern Mask ExtValidMasks[];
*/ */
int int
SProcXSelectExtensionEvent (client) SProcXSelectExtensionEvent(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xSelectExtensionEventReq); REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq); REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
...@@ -91,8 +91,8 @@ register ClientPtr client; ...@@ -91,8 +91,8 @@ register ClientPtr client;
stuff->count * sizeof(CARD32)); stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count); SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return(ProcXSelectExtensionEvent(client)); return (ProcXSelectExtensionEvent(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -101,48 +101,46 @@ register ClientPtr client; ...@@ -101,48 +101,46 @@ register ClientPtr client;
*/ */
int int
ProcXSelectExtensionEvent (client) ProcXSelectExtensionEvent(register ClientPtr client)
register ClientPtr client; {
{ int ret;
int ret; int i;
int i; WindowPtr pWin;
WindowPtr pWin; struct tmask tmp[EMASKSIZE];
struct tmask tmp[EMASKSIZE];
REQUEST(xSelectExtensionEventReq); REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq); REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
if (stuff->length !=(sizeof(xSelectExtensionEventReq)>>2) + stuff->count) if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) {
{ SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
SendErrorToClient (client, IReqCode, X_SelectExtensionEvent, 0, BadLength);
BadLength);
return Success; return Success;
} }
pWin = (WindowPtr) LookupWindow (stuff->window, client); pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) if (!pWin) {
{
client->errorValue = stuff->window; client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadWindow); BadWindow);
return Success; return Success;
} }
if ((ret = CreateMaskFromList (client, (XEventClass *)&stuff[1], if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL, X_SelectExtensionEvent)) != Success) stuff->count, tmp, NULL,
X_SelectExtensionEvent)) != Success)
return Success; return Success;
for (i=0; i<EMASKSIZE; i++) for (i = 0; i < EMASKSIZE; i++)
if (tmp[i].dev != NULL) if (tmp[i].dev != NULL) {
{ if ((ret =
if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask, SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
ExtExclusiveMasks[i], ExtValidMasks[i])) != Success) tmp[i].mask, ExtExclusiveMasks[i],
{ ExtValidMasks[i])) != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
ret); ret);
return Success; return Success;
}
} }
}
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SELECTEV_H #ifndef SELECTEV_H
#define SELECTEV_H 1 #define SELECTEV_H 1
int int SProcXSelectExtensionEvent(ClientPtr /* client */
SProcXSelectExtensionEvent ( );
ClientPtr /* client */
); int ProcXSelectExtensionEvent(ClientPtr /* client */
);
int
ProcXSelectExtensionEvent (
ClientPtr /* client */
);
#endif /* SELECTEV_H */ #endif /* SELECTEV_H */
...@@ -56,21 +56,21 @@ SOFTWARE. ...@@ -56,21 +56,21 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* Window */ #include "windowstr.h" /* Window */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
#include "grabdev.h" #include "grabdev.h"
#include "sendexev.h" #include "sendexev.h"
extern int lastEvent; /* Defined in extension.c */ extern int lastEvent; /* Defined in extension.c */
/*********************************************************************** /***********************************************************************
* *
...@@ -79,9 +79,8 @@ extern int lastEvent; /* Defined in extension.c */ ...@@ -79,9 +79,8 @@ extern int lastEvent; /* Defined in extension.c */
*/ */
int int
SProcXSendExtensionEvent(client) SProcXSendExtensionEvent(register ClientPtr client)
register ClientPtr client; {
{
CARD32 *p; CARD32 *p;
register int i; register int i;
xEvent eventT; xEvent eventT;
...@@ -98,20 +97,19 @@ SProcXSendExtensionEvent(client) ...@@ -98,20 +97,19 @@ SProcXSendExtensionEvent(client)
(stuff->num_events * (sizeof(xEvent) >> 2))) (stuff->num_events * (sizeof(xEvent) >> 2)))
return BadLength; return BadLength;
eventP = (xEvent *) &stuff[1]; eventP = (xEvent *) & stuff[1];
for (i=0; i<stuff->num_events; i++,eventP++) for (i = 0; i < stuff->num_events; i++, eventP++) {
{
proc = EventSwapVector[eventP->u.u.type & 0177]; 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); return (BadValue);
(*proc)(eventP, &eventT); (*proc) (eventP, &eventT);
*eventP = eventT; *eventP = eventT;
} }
p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events); p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
SwapLongs(p, stuff->count); SwapLongs(p, stuff->count);
return(ProcXSendExtensionEvent(client)); return (ProcXSendExtensionEvent(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -121,33 +119,28 @@ SProcXSendExtensionEvent(client) ...@@ -121,33 +119,28 @@ SProcXSendExtensionEvent(client)
*/ */
int int
ProcXSendExtensionEvent (client) ProcXSendExtensionEvent(register ClientPtr client)
register ClientPtr client; {
{ int ret;
int ret; DeviceIntPtr dev;
DeviceIntPtr dev; xEvent *first;
xEvent *first; XEventClass *list;
XEventClass *list; struct tmask tmp[EMASKSIZE];
struct tmask tmp[EMASKSIZE];
REQUEST(xSendExtensionEventReq); REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(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))) (stuff->num_events * (sizeof(xEvent) >> 2))) {
{ SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadLength);
SendErrorToClient (client, IReqCode, X_SendExtensionEvent, 0,
BadLength);
return Success; return Success;
} }
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
BadDevice);
return Success; return Success;
} }
/* /*
the previous code here returned the unitialized variable ret, the previous code here returned the unitialized variable ret,
...@@ -160,27 +153,25 @@ ProcXSendExtensionEvent (client) ...@@ -160,27 +153,25 @@ ProcXSendExtensionEvent (client)
/* The client's event type must be one defined by an extension. */ /* The client's event type must be one defined by an extension. */
first = ((xEvent *) &stuff[1]); first = ((xEvent *) & stuff[1]);
if ( ! ((EXTENSION_EVENT_BASE <= first->u.u.type) && if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
(first->u.u.type < lastEvent)) ) (first->u.u.type < lastEvent))) {
{
client->errorValue = first->u.u.type; client->errorValue = first->u.u.type;
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadValue);
BadValue);
return Success; return Success;
} }
list = (XEventClass *) (first + stuff->num_events); list = (XEventClass *) (first + stuff->num_events);
if ((ret = CreateMaskFromList (client, list, stuff->count, tmp, dev, if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
X_SendExtensionEvent)) != Success) X_SendExtensionEvent)) != Success)
return 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->propagate, (xEvent *) & stuff[1],
stuff->num_events)); tmp[stuff->deviceid].mask, stuff->num_events));
if (ret != Success) if (ret != Success)
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret); SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SENDEXEV_H #ifndef SENDEXEV_H
#define SENDEXEV_H 1 #define SENDEXEV_H 1
int int SProcXSendExtensionEvent(ClientPtr /* client */
SProcXSendExtensionEvent( );
ClientPtr /* client */
); int ProcXSendExtensionEvent(ClientPtr /* client */
);
int
ProcXSendExtensionEvent(
ClientPtr /* client */
);
#endif /* SENDEXEV_H */ #endif /* SENDEXEV_H */
...@@ -58,14 +58,14 @@ SOFTWARE. ...@@ -58,14 +58,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "exevents.h" #include "exevents.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "setbmap.h" #include "setbmap.h"
...@@ -77,13 +77,12 @@ SOFTWARE. ...@@ -77,13 +77,12 @@ SOFTWARE.
*/ */
int int
SProcXSetDeviceButtonMapping(client) SProcXSetDeviceButtonMapping(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xSetDeviceButtonMappingReq); REQUEST(xSetDeviceButtonMappingReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXSetDeviceButtonMapping(client)); return (ProcXSetDeviceButtonMapping(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -92,23 +91,21 @@ SProcXSetDeviceButtonMapping(client) ...@@ -92,23 +91,21 @@ SProcXSetDeviceButtonMapping(client)
*/ */
int int
ProcXSetDeviceButtonMapping (client) ProcXSetDeviceButtonMapping(register ClientPtr client)
register ClientPtr client; {
{ int ret;
int ret; xSetDeviceButtonMappingReply rep;
xSetDeviceButtonMappingReply rep;
DeviceIntPtr dev; DeviceIntPtr dev;
REQUEST(xSetDeviceButtonMappingReq); REQUEST(xSetDeviceButtonMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq); REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) + if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
stuff->map_length + 3)>>2) stuff->map_length + 3) >> 2) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, BadLength);
BadLength);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_SetDeviceButtonMapping; rep.RepType = X_SetDeviceButtonMapping;
...@@ -116,32 +113,27 @@ ProcXSetDeviceButtonMapping (client) ...@@ -116,32 +113,27 @@ ProcXSetDeviceButtonMapping (client)
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.status = MappingSuccess; rep.status = MappingSuccess;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, BadDevice);
BadDevice);
return Success; 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) if (ret == BadValue || ret == BadMatch) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, ret);
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
ret);
return Success; return Success;
} } else {
else
{
rep.status = ret; rep.status = ret;
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep); WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
} }
if (ret != MappingBusy) if (ret != MappingBusy)
SendDeviceMappingNotify(MappingPointer, 0, 0, dev); SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -151,12 +143,10 @@ ProcXSetDeviceButtonMapping (client) ...@@ -151,12 +143,10 @@ ProcXSetDeviceButtonMapping (client)
*/ */
void void
SRepXSetDeviceButtonMapping (client, size, rep) SRepXSetDeviceButtonMapping(ClientPtr client, int size,
ClientPtr client; xSetDeviceButtonMappingReply * rep)
int size; {
xSetDeviceButtonMappingReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETBMAP_H #ifndef SETBMAP_H
#define SETBMAP_H 1 #define SETBMAP_H 1
int int SProcXSetDeviceButtonMapping(ClientPtr /* client */
SProcXSetDeviceButtonMapping( );
ClientPtr /* client */
); int ProcXSetDeviceButtonMapping(ClientPtr /* client */
);
int
ProcXSetDeviceButtonMapping( void SRepXSetDeviceButtonMapping(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xSetDeviceButtonMappingReply * /* rep */
);
void
SRepXSetDeviceButtonMapping(
ClientPtr /* client */,
int /* size */,
xSetDeviceButtonMappingReply * /* rep */
);
#endif /* SETBMAP_H */ #endif /* SETBMAP_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "setdval.h" #include "setdval.h"
...@@ -74,13 +74,12 @@ SOFTWARE. ...@@ -74,13 +74,12 @@ SOFTWARE.
*/ */
int int
SProcXSetDeviceValuators(client) SProcXSetDeviceValuators(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xSetDeviceValuatorsReq); REQUEST(xSetDeviceValuatorsReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXSetDeviceValuators(client)); return (ProcXSetDeviceValuators(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -89,11 +88,10 @@ SProcXSetDeviceValuators(client) ...@@ -89,11 +88,10 @@ SProcXSetDeviceValuators(client)
*/ */
int int
ProcXSetDeviceValuators(client) ProcXSetDeviceValuators(register ClientPtr client)
register ClientPtr client; {
{
DeviceIntPtr dev; DeviceIntPtr dev;
xSetDeviceValuatorsReply rep; xSetDeviceValuatorsReply rep;
REQUEST(xSetDeviceValuatorsReq); REQUEST(xSetDeviceValuatorsReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq); REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
...@@ -104,48 +102,41 @@ ProcXSetDeviceValuators(client) ...@@ -104,48 +102,41 @@ ProcXSetDeviceValuators(client)
rep.status = Success; rep.status = Success;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
if (stuff->length !=(sizeof(xSetDeviceValuatorsReq)>>2) + if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) +
stuff->num_valuators) stuff->num_valuators) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadLength);
SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
BadLength);
return Success; return Success;
} }
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice);
SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
BadDevice);
return Success; return Success;
} }
if (dev->valuator == NULL) if (dev->valuator == NULL) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch);
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
BadMatch);
return Success; return Success;
} }
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue);
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
BadValue);
return Success; return Success;
} }
if ((dev->grab) && !SameClient(dev->grab, client)) if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
else else
rep.status = SetDeviceValuators (client, dev, (int *) &stuff[1], rep.status = SetDeviceValuators(client, dev, (int *)&stuff[1],
stuff->first_valuator, stuff->num_valuators); stuff->first_valuator,
stuff->num_valuators);
if (rep.status != Success && rep.status != AlreadyGrabbed) if (rep.status != Success && rep.status != AlreadyGrabbed)
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
rep.status); rep.status);
else else
WriteReplyToClient (client, sizeof (xSetDeviceValuatorsReply), &rep); WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -155,12 +146,10 @@ ProcXSetDeviceValuators(client) ...@@ -155,12 +146,10 @@ ProcXSetDeviceValuators(client)
*/ */
void void
SRepXSetDeviceValuators (client, size, rep) SRepXSetDeviceValuators(ClientPtr client, int size,
ClientPtr client; xSetDeviceValuatorsReply * rep)
int size; {
xSetDeviceValuatorsReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETDVAL_H #ifndef SETDVAL_H
#define SETDVAL_H 1 #define SETDVAL_H 1
int int SProcXSetDeviceValuators(ClientPtr /* client */
SProcXSetDeviceValuators( );
ClientPtr /* client */
); int ProcXSetDeviceValuators(ClientPtr /* client */
);
int
ProcXSetDeviceValuators( void SRepXSetDeviceValuators(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xSetDeviceValuatorsReply * /* rep */
);
void
SRepXSetDeviceValuators(
ClientPtr /* client */,
int /* size */,
xSetDeviceValuatorsReply * /* rep */
);
#endif /* SETDVAL_H */ #endif /* SETDVAL_H */
...@@ -55,17 +55,17 @@ SOFTWARE. ...@@ -55,17 +55,17 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */ #include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "dixevents.h" #include "dixevents.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "setfocus.h" #include "setfocus.h"
...@@ -77,16 +77,15 @@ SOFTWARE. ...@@ -77,16 +77,15 @@ SOFTWARE.
*/ */
int int
SProcXSetDeviceFocus(client) SProcXSetDeviceFocus(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xSetDeviceFocusReq); REQUEST(xSetDeviceFocusReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
swapl(&stuff->focus); swapl(&stuff->focus);
swapl(&stuff->time); swapl(&stuff->time);
return(ProcXSetDeviceFocus(client)); return (ProcXSetDeviceFocus(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -95,26 +94,24 @@ SProcXSetDeviceFocus(client) ...@@ -95,26 +94,24 @@ SProcXSetDeviceFocus(client)
*/ */
int int
ProcXSetDeviceFocus(client) ProcXSetDeviceFocus(register ClientPtr client)
register ClientPtr client; {
{ int ret;
int ret; register DeviceIntPtr dev;
register DeviceIntPtr dev;
REQUEST(xSetDeviceFocusReq); REQUEST(xSetDeviceFocusReq);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
dev = LookupDeviceIntRec (stuff->device); dev = LookupDeviceIntRec(stuff->device);
if (dev==NULL || !dev->focus) if (dev == NULL || !dev->focus) {
{
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice); SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
return Success; return Success;
} }
ret = SetInputFocus (client, dev, stuff->focus, stuff->revertTo, ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo,
stuff->time, TRUE); stuff->time, TRUE);
if (ret != Success) if (ret != Success)
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret); SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETFOCUS_H #ifndef SETFOCUS_H
#define SETFOCUS_H 1 #define SETFOCUS_H 1
int int SProcXSetDeviceFocus(ClientPtr /* client */
SProcXSetDeviceFocus( );
ClientPtr /* client */
); int ProcXSetDeviceFocus(ClientPtr /* client */
);
int
ProcXSetDeviceFocus(
ClientPtr /* client */
);
#endif /* SETFOCUS_H */ #endif /* SETFOCUS_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "exevents.h" #include "exevents.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "setmmap.h" #include "setmmap.h"
...@@ -75,13 +75,12 @@ SOFTWARE. ...@@ -75,13 +75,12 @@ SOFTWARE.
*/ */
int int
SProcXSetDeviceModifierMapping(client) SProcXSetDeviceModifierMapping(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xSetDeviceModifierMappingReq); REQUEST(xSetDeviceModifierMappingReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXSetDeviceModifierMapping(client)); return (ProcXSetDeviceModifierMapping(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -90,24 +89,22 @@ SProcXSetDeviceModifierMapping(client) ...@@ -90,24 +89,22 @@ SProcXSetDeviceModifierMapping(client)
*/ */
int int
ProcXSetDeviceModifierMapping(client) ProcXSetDeviceModifierMapping(ClientPtr client)
ClientPtr client; {
{ int ret;
int ret; xSetDeviceModifierMappingReply rep;
xSetDeviceModifierMappingReply rep; DeviceIntPtr dev;
DeviceIntPtr dev; KeyClassPtr kp;
KeyClassPtr kp;
REQUEST(xSetDeviceModifierMappingReq); REQUEST(xSetDeviceModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq); REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0,
SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0, BadDevice);
BadDevice);
return Success; return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_SetDeviceModifierMapping; rep.RepType = X_SetDeviceModifierMapping;
...@@ -115,26 +112,24 @@ ProcXSetDeviceModifierMapping(client) ...@@ -115,26 +112,24 @@ ProcXSetDeviceModifierMapping(client)
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
ret = SetModifierMapping(client, dev, stuff->length, ret = SetModifierMapping(client, dev, stuff->length,
(sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier, (sizeof(xSetDeviceModifierMappingReq) >> 2),
(BYTE *)&stuff[1], &kp); stuff->numKeyPerModifier, (BYTE *) & stuff[1],
&kp);
if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed) if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
{
rep.success = ret; rep.success = ret;
if (ret == MappingSuccess) if (ret == MappingSuccess)
SendDeviceMappingNotify(MappingModifier, 0, 0, dev); SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),&rep); WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
} &rep);
else } else {
{ if (ret == -1)
if (ret==-1) ret = BadValue;
ret=BadValue; SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret);
SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,ret); }
}
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -144,13 +139,10 @@ ProcXSetDeviceModifierMapping(client) ...@@ -144,13 +139,10 @@ ProcXSetDeviceModifierMapping(client)
*/ */
void void
SRepXSetDeviceModifierMapping (client, size, rep) SRepXSetDeviceModifierMapping(ClientPtr client, int size,
ClientPtr client; xSetDeviceModifierMappingReply * rep)
int size; {
xSetDeviceModifierMappingReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETMMAP_H #ifndef SETMMAP_H
#define SETMMAP_H 1 #define SETMMAP_H 1
int int SProcXSetDeviceModifierMapping(ClientPtr /* client */
SProcXSetDeviceModifierMapping( );
ClientPtr /* client */
); int ProcXSetDeviceModifierMapping(ClientPtr /* client */
);
int
ProcXSetDeviceModifierMapping( void SRepXSetDeviceModifierMapping(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xSetDeviceModifierMappingReply * /* rep */
);
void
SRepXSetDeviceModifierMapping(
ClientPtr /* client */,
int /* size */,
xSetDeviceModifierMappingReply * /* rep */
);
#endif /* SETMMAP_H */ #endif /* SETMMAP_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "setmode.h" #include "setmode.h"
...@@ -74,13 +74,12 @@ SOFTWARE. ...@@ -74,13 +74,12 @@ SOFTWARE.
*/ */
int int
SProcXSetDeviceMode(client) SProcXSetDeviceMode(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xSetDeviceModeReq); REQUEST(xSetDeviceModeReq);
swaps(&stuff->length); swaps(&stuff->length);
return(ProcXSetDeviceMode(client)); return (ProcXSetDeviceMode(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -89,11 +88,10 @@ SProcXSetDeviceMode(client) ...@@ -89,11 +88,10 @@ SProcXSetDeviceMode(client)
*/ */
int int
ProcXSetDeviceMode(client) ProcXSetDeviceMode(register ClientPtr client)
register ClientPtr client; {
{
DeviceIntPtr dev; DeviceIntPtr dev;
xSetDeviceModeReply rep; xSetDeviceModeReply rep;
REQUEST(xSetDeviceModeReq); REQUEST(xSetDeviceModeReq);
REQUEST_SIZE_MATCH(xSetDeviceModeReq); REQUEST_SIZE_MATCH(xSetDeviceModeReq);
...@@ -103,33 +101,30 @@ ProcXSetDeviceMode(client) ...@@ -103,33 +101,30 @@ ProcXSetDeviceMode(client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice);
SendErrorToClient (client, IReqCode, X_SetDeviceMode, 0, BadDevice);
return Success; return Success;
} }
if (dev->valuator == NULL) if (dev->valuator == NULL) {
{
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch); SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
return Success; return Success;
} }
if ((dev->grab) && !SameClient(dev->grab, client)) if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
else else
rep.status = SetDeviceMode (client, dev, stuff->mode); rep.status = SetDeviceMode(client, dev, stuff->mode);
if (rep.status == Success) if (rep.status == Success)
dev->valuator->mode = stuff->mode; dev->valuator->mode = stuff->mode;
else if (rep.status != AlreadyGrabbed) else if (rep.status != AlreadyGrabbed) {
{
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status); SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
return Success; return Success;
} }
WriteReplyToClient (client, sizeof (xSetDeviceModeReply), &rep); WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
return Success; return Success;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -139,12 +134,9 @@ ProcXSetDeviceMode(client) ...@@ -139,12 +134,9 @@ ProcXSetDeviceMode(client)
*/ */
void void
SRepXSetDeviceMode (client, size, rep) SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep)
ClientPtr client; {
int size;
xSetDeviceModeReply *rep;
{
swaps(&rep->sequenceNumber); swaps(&rep->sequenceNumber);
swapl(&rep->length); swapl(&rep->length);
WriteToClient(client, size, rep); WriteToClient(client, size, rep);
} }
...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,21 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETMODE_H #ifndef SETMODE_H
#define SETMODE_H 1 #define SETMODE_H 1
int int SProcXSetDeviceMode(ClientPtr /* client */
SProcXSetDeviceMode( );
ClientPtr /* client */
); int ProcXSetDeviceMode(ClientPtr /* client */
);
int
ProcXSetDeviceMode( void SRepXSetDeviceMode(ClientPtr /* client */ ,
ClientPtr /* client */ int /* size */ ,
); xSetDeviceModeReply * /* rep */
);
void
SRepXSetDeviceMode(
ClientPtr /* client */,
int /* size */,
xSetDeviceModeReply * /* rep */
);
#endif /* SETMODE_H */ #endif /* SETMODE_H */
...@@ -91,16 +91,13 @@ SOFTWARE. ...@@ -91,16 +91,13 @@ SOFTWARE.
*/ */
int int
ChangeKeyboardDevice (old_dev, new_dev) ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
DeviceIntPtr old_dev; {
DeviceIntPtr new_dev;
{
/*********************************************************************** /***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/ **********************************************************************/
return BadMatch; return BadMatch;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -133,12 +130,9 @@ ChangeKeyboardDevice (old_dev, new_dev) ...@@ -133,12 +130,9 @@ ChangeKeyboardDevice (old_dev, new_dev)
*/ */
int int
ChangePointerDevice ( ChangePointerDevice(DeviceIntPtr old_dev,
DeviceIntPtr old_dev, DeviceIntPtr new_dev, unsigned char x, unsigned char y)
DeviceIntPtr new_dev, {
unsigned char x,
unsigned char y)
{
/*********************************************************************** /***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
...@@ -150,7 +144,7 @@ ChangePointerDevice ( ...@@ -150,7 +144,7 @@ ChangePointerDevice (
axes_changed = FALSE; axes_changed = FALSE;
*************************************************************************/ *************************************************************************/
return BadMatch; return BadMatch;
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -166,11 +160,9 @@ ChangePointerDevice ( ...@@ -166,11 +160,9 @@ ChangePointerDevice (
*/ */
void void
CloseInputDevice (d, client) CloseInputDevice(DeviceIntPtr d, ClientPtr client)
DeviceIntPtr d; {
ClientPtr client; }
{
}
/*********************************************************************** /***********************************************************************
* *
...@@ -199,8 +191,8 @@ CloseInputDevice (d, client) ...@@ -199,8 +191,8 @@ CloseInputDevice (d, client)
*/ */
void void
AddOtherInputDevices () AddOtherInputDevices(void)
{ {
/********************************************************************** /**********************************************************************
for each uninitialized device, do something like: for each uninitialized device, do something like:
...@@ -214,7 +206,7 @@ AddOtherInputDevices () ...@@ -214,7 +206,7 @@ AddOtherInputDevices ()
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
************************************************************************/ ************************************************************************/
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -239,12 +231,9 @@ AddOtherInputDevices () ...@@ -239,12 +231,9 @@ AddOtherInputDevices ()
*/ */
void void
OpenInputDevice (dev, client, status) OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
DeviceIntPtr dev; {
ClientPtr client; }
int *status;
{
}
/**************************************************************************** /****************************************************************************
* *
...@@ -259,13 +248,10 @@ OpenInputDevice (dev, client, status) ...@@ -259,13 +248,10 @@ OpenInputDevice (dev, client, status)
*/ */
int int
SetDeviceMode (client, dev, mode) SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode)
register ClientPtr client; {
DeviceIntPtr dev;
int mode;
{
return BadMatch; return BadMatch;
} }
/**************************************************************************** /****************************************************************************
* *
...@@ -280,15 +266,11 @@ SetDeviceMode (client, dev, mode) ...@@ -280,15 +266,11 @@ SetDeviceMode (client, dev, mode)
*/ */
int int
SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev,
register ClientPtr client; int *valuators, int first_valuator, int num_valuators)
DeviceIntPtr dev; {
int *valuators;
int first_valuator;
int num_valuators;
{
return BadMatch; return BadMatch;
} }
/**************************************************************************** /****************************************************************************
* *
...@@ -299,16 +281,13 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) ...@@ -299,16 +281,13 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
*/ */
int int
ChangeDeviceControl (client, dev, control) ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
register ClientPtr client; xDeviceCtl * control)
DeviceIntPtr dev; {
xDeviceCtl *control; switch (control->control) {
{ case DEVICE_RESOLUTION:
switch (control->control) return (BadMatch);
{ default:
case DEVICE_RESOLUTION: return (BadMatch);
return (BadMatch);
default:
return (BadMatch);
}
} }
}
...@@ -55,13 +55,13 @@ SOFTWARE. ...@@ -55,13 +55,13 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "ungrdev.h" #include "ungrdev.h"
...@@ -73,15 +73,14 @@ SOFTWARE. ...@@ -73,15 +73,14 @@ SOFTWARE.
*/ */
int int
SProcXUngrabDevice(client) SProcXUngrabDevice(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xUngrabDeviceReq); REQUEST(xUngrabDeviceReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceReq); REQUEST_SIZE_MATCH(xUngrabDeviceReq);
swapl(&stuff->time); swapl(&stuff->time);
return(ProcXUngrabDevice(client)); return (ProcXUngrabDevice(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -90,28 +89,26 @@ register ClientPtr client; ...@@ -90,28 +89,26 @@ register ClientPtr client;
*/ */
int int
ProcXUngrabDevice(client) ProcXUngrabDevice(register ClientPtr client)
register ClientPtr client; {
{ DeviceIntPtr dev;
DeviceIntPtr dev; GrabPtr grab;
GrabPtr grab; TimeStamp time;
TimeStamp time;
REQUEST(xUngrabDeviceReq); REQUEST(xUngrabDeviceReq);
REQUEST_SIZE_MATCH(xUngrabDeviceReq); REQUEST_SIZE_MATCH(xUngrabDeviceReq);
dev = LookupDeviceIntRec (stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) if (dev == NULL) {
{
SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice); SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
return Success; return Success;
} }
grab = dev->grab; grab = dev->grab;
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, dev->grabTime) != EARLIER) && (CompareTimeStamps(time, dev->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client))
(*dev->DeactivateGrab)(dev); (*dev->DeactivateGrab) (dev);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef UNGRDEV_H #ifndef UNGRDEV_H
#define UNGRDEV_H 1 #define UNGRDEV_H 1
int int SProcXUngrabDevice(ClientPtr /* client */
SProcXUngrabDevice( );
ClientPtr /* client */
); int ProcXUngrabDevice(ClientPtr /* client */
);
int
ProcXUngrabDevice(
ClientPtr /* client */
);
#endif /* UNGRDEV_H */ #endif /* UNGRDEV_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "dixgrabs.h" #include "dixgrabs.h"
...@@ -79,16 +79,15 @@ SOFTWARE. ...@@ -79,16 +79,15 @@ SOFTWARE.
*/ */
int int
SProcXUngrabDeviceButton(client) SProcXUngrabDeviceButton(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xUngrabDeviceButtonReq); REQUEST(xUngrabDeviceButtonReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
swapl(&stuff->grabWindow); swapl(&stuff->grabWindow);
swaps(&stuff->modifiers); swaps(&stuff->modifiers);
return(ProcXUngrabDeviceButton(client)); return (ProcXUngrabDeviceButton(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -97,65 +96,52 @@ SProcXUngrabDeviceButton(client) ...@@ -97,65 +96,52 @@ SProcXUngrabDeviceButton(client)
*/ */
int int
ProcXUngrabDeviceButton(client) ProcXUngrabDeviceButton(ClientPtr client)
ClientPtr client; {
{ DeviceIntPtr dev;
DeviceIntPtr dev; DeviceIntPtr mdev;
DeviceIntPtr mdev; WindowPtr pWin;
WindowPtr pWin; GrabRec temporaryGrab;
GrabRec temporaryGrab;
REQUEST(xUngrabDeviceButtonReq); REQUEST(xUngrabDeviceButtonReq);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
dev = LookupDeviceIntRec (stuff->grabbed_device); dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadDevice);
return Success; return Success;
} }
if (dev->button == NULL) if (dev->button == NULL) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadMatch);
return Success; return Success;
} }
if (stuff->modifier_device != UseXKeyboard) if (stuff->modifier_device != UseXKeyboard) {
{ mdev = LookupDeviceIntRec(stuff->modifier_device);
mdev = LookupDeviceIntRec (stuff->modifier_device); if (mdev == NULL) {
if (mdev == NULL) SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
{ BadDevice);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadDevice);
return Success; return Success;
} }
if (mdev->key == NULL) if (mdev->key == NULL) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch);
BadMatch);
return Success; return Success;
}
} }
else } else
mdev = (DeviceIntPtr) LookupKeyboardDevice(); mdev = (DeviceIntPtr) LookupKeyboardDevice();
pWin = LookupWindow(stuff->grabWindow, client); pWin = LookupWindow(stuff->grabWindow, client);
if (!pWin) if (!pWin) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadWindow);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadWindow);
return Success; return Success;
} }
if ((stuff->modifiers != AnyModifier) && if ((stuff->modifiers != AnyModifier) &&
(stuff->modifiers & ~AllModifiersMask)) (stuff->modifiers & ~AllModifiersMask)) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadValue);
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadValue);
return Success; return Success;
} }
temporaryGrab.resource = client->clientAsMask; temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev; temporaryGrab.device = dev;
...@@ -169,4 +155,4 @@ ProcXUngrabDeviceButton(client) ...@@ -169,4 +155,4 @@ ProcXUngrabDeviceButton(client)
DeletePassiveGrabFromList(&temporaryGrab); DeletePassiveGrabFromList(&temporaryGrab);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef UNGRDEVB_H #ifndef UNGRDEVB_H
#define UNGRDEVB_H 1 #define UNGRDEVB_H 1
int int SProcXUngrabDeviceButton(ClientPtr /* client */
SProcXUngrabDeviceButton( );
ClientPtr /* client */
); int ProcXUngrabDeviceButton(ClientPtr /* client */
);
int
ProcXUngrabDeviceButton(
ClientPtr /* client */
);
#endif /* UNGRDEVB_H */ #endif /* UNGRDEVB_H */
...@@ -55,14 +55,14 @@ SOFTWARE. ...@@ -55,14 +55,14 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <nx-X11/X.h> /* for inputstr.h */ #include <nx-X11/X.h> /* for inputstr.h */
#include <nx-X11/Xproto.h> /* Request macro */ #include <nx-X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <nx-X11/extensions/XI.h> #include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h> #include <nx-X11/extensions/XIproto.h>
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "dixgrabs.h" #include "dixgrabs.h"
...@@ -79,16 +79,15 @@ SOFTWARE. ...@@ -79,16 +79,15 @@ SOFTWARE.
*/ */
int int
SProcXUngrabDeviceKey(client) SProcXUngrabDeviceKey(register ClientPtr client)
register ClientPtr client; {
{
REQUEST(xUngrabDeviceKeyReq); REQUEST(xUngrabDeviceKeyReq);
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
swapl(&stuff->grabWindow); swapl(&stuff->grabWindow);
swaps(&stuff->modifiers); swaps(&stuff->modifiers);
return(ProcXUngrabDeviceKey(client)); return (ProcXUngrabDeviceKey(client));
} }
/*********************************************************************** /***********************************************************************
* *
...@@ -97,76 +96,61 @@ SProcXUngrabDeviceKey(client) ...@@ -97,76 +96,61 @@ SProcXUngrabDeviceKey(client)
*/ */
int int
ProcXUngrabDeviceKey(client) ProcXUngrabDeviceKey(ClientPtr client)
ClientPtr client; {
{ DeviceIntPtr dev;
DeviceIntPtr dev; DeviceIntPtr mdev;
DeviceIntPtr mdev; WindowPtr pWin;
WindowPtr pWin; GrabRec temporaryGrab;
GrabRec temporaryGrab;
REQUEST(xUngrabDeviceKeyReq); REQUEST(xUngrabDeviceKeyReq);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
dev = LookupDeviceIntRec (stuff->grabbed_device); dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) if (dev == NULL) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadDevice);
return Success; return Success;
} }
if (dev->key == NULL) if (dev->key == NULL) {
{
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
return Success; return Success;
} }
if (stuff->modifier_device != UseXKeyboard) if (stuff->modifier_device != UseXKeyboard) {
{ mdev = LookupDeviceIntRec(stuff->modifier_device);
mdev = LookupDeviceIntRec (stuff->modifier_device); if (mdev == NULL) {
if (mdev == NULL) SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
{ BadDevice);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadDevice);
return Success; return Success;
} }
if (mdev->key == NULL) if (mdev->key == NULL) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadMatch);
return Success; return Success;
}
} }
else } else
mdev = (DeviceIntPtr) LookupKeyboardDevice(); mdev = (DeviceIntPtr) LookupKeyboardDevice();
pWin = LookupWindow(stuff->grabWindow, client); pWin = LookupWindow(stuff->grabWindow, client);
if (!pWin) if (!pWin) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadWindow);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadWindow);
return Success; return Success;
} }
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) || if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
(stuff->key < dev->key->curKeySyms.minKeyCode)) (stuff->key < dev->key->curKeySyms.minKeyCode))
&& (stuff->key != AnyKey)) && (stuff->key != AnyKey)) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadValue);
return Success; return Success;
} }
if ((stuff->modifiers != AnyModifier) && if ((stuff->modifiers != AnyModifier) &&
(stuff->modifiers & ~AllModifiersMask)) (stuff->modifiers & ~AllModifiersMask)) {
{ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadValue);
return Success; return Success;
} }
temporaryGrab.resource = client->clientAsMask; temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev; temporaryGrab.device = dev;
temporaryGrab.window = pWin; temporaryGrab.window = pWin;
temporaryGrab.type = DeviceKeyPress; temporaryGrab.type = DeviceKeyPress;
temporaryGrab.modifierDevice = mdev; temporaryGrab.modifierDevice = mdev;
temporaryGrab.modifiersDetail.exact = stuff->modifiers; temporaryGrab.modifiersDetail.exact = stuff->modifiers;
temporaryGrab.modifiersDetail.pMask = NULL; temporaryGrab.modifiersDetail.pMask = NULL;
...@@ -175,4 +159,4 @@ ProcXUngrabDeviceKey(client) ...@@ -175,4 +159,4 @@ ProcXUngrabDeviceKey(client)
DeletePassiveGrabFromList(&temporaryGrab); DeletePassiveGrabFromList(&temporaryGrab);
return Success; return Success;
} }
...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef UNGRDEVK_H #ifndef UNGRDEVK_H
#define UNGRDEVK_H 1 #define UNGRDEVK_H 1
int int SProcXUngrabDeviceKey(ClientPtr /* client */
SProcXUngrabDeviceKey( );
ClientPtr /* client */
); int ProcXUngrabDeviceKey(ClientPtr /* client */
);
int
ProcXUngrabDeviceKey(
ClientPtr /* client */
);
#endif /* UNGRDEVK_H */ #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