Input: Return errors to the dispatcher instead of sending them ourself.

Also fixed two "unused variable: stuff" warnings.
This commit is contained in:
Eamon Walsh 2007-09-24 13:33:01 -04:00 committed by Eamon Walsh
parent 56ffc381d3
commit 31a7994ac7
35 changed files with 267 additions and 652 deletions

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -103,10 +100,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
thisdev = LookupDeviceIntRec(stuff->deviceid);
if (thisdev == NULL) {
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
return Success;
}
if (thisdev == NULL)
return BadDevice;
time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode) {
@ -129,9 +124,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue);
client->errorValue = stuff->mode;
return Success;
return BadValue;
}
return Success;
}

View File

@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "exevents.h"
@ -153,11 +150,8 @@ ProcXChangeDeviceControl(ClientPtr client)
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;
}
*(resolution + i) > (a + i)->max_resolution)
return BadValue;
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
@ -269,11 +263,8 @@ out:
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
}
else {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
}
return Success;
return ret;
}
/***********************************************************************

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -119,9 +116,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.click;
else if (t < 0 || t > 100) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
kctrl.click = t;
}
@ -132,9 +127,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
kctrl.bell = t;
}
@ -145,9 +138,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
kctrl.bell_pitch = t;
}
@ -158,9 +149,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
kctrl.bell_duration = t;
}
@ -174,15 +163,10 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
key = (KeyCode) f->key;
if (key < 8 || key > 255) {
client->errorValue = key;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
if (!(mask & DvAutoRepeatMode)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadMatch);
return Success;
return BadValue;
}
if (!(mask & DvAutoRepeatMode))
return BadMatch;
}
if (mask & DvAutoRepeatMode) {
@ -210,9 +194,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
(defaultKeyboardControl.autoRepeats[inx] & kmask);
} else {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
}
@ -250,9 +232,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
pctrl.num = defaultPointerControl.num;
else if (accelNum < 0) {
client->errorValue = accelNum;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
} else
pctrl.num = accelNum;
}
@ -265,9 +245,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
pctrl.den = defaultPointerControl.den;
else if (accelDenom <= 0) {
client->errorValue = accelDenom;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
} else
pctrl.den = accelDenom;
}
@ -280,9 +258,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
pctrl.threshold = defaultPointerControl.threshold;
else if (threshold < 0) {
client->errorValue = threshold;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
} else
pctrl.threshold = threshold;
}
@ -341,21 +317,16 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
}
}
if (f->num_keysyms > s->ctrl.max_symbols) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
}
if (f->num_keysyms > s->ctrl.max_symbols)
return BadValue;
sup_syms = s->ctrl.symbols_supported;
for (i = 0; i < f->num_keysyms; i++) {
for (j = 0; j < s->ctrl.num_symbols_supported; j++)
if (*(syms + i) == *(sup_syms + j))
break;
if (j == s->ctrl.num_symbols_supported) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadMatch);
return Success;
}
if (j == s->ctrl.num_symbols_supported)
return BadMatch;
}
s->ctrl.num_symbols_displayed = f->num_keysyms;
@ -393,9 +364,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
bctrl.percent = t;
}
@ -406,9 +375,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
bctrl.pitch = t;
}
@ -419,9 +386,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadValue);
return Success;
return BadValue;
}
bctrl.duration = t;
}
@ -485,38 +450,27 @@ ProcXChangeFeedbackControl(ClientPtr client)
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
switch (stuff->feedbackid) {
case KbdFeedbackClass:
if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
if (len != (sizeof(xKbdFeedbackCtl) >> 2))
return 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;
}
if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id)
return ChangeKbdFeedback(client, dev, stuff->mask, k,
(xKbdFeedbackCtl *) & stuff[1]);
break;
case PtrFeedbackClass:
if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
if (len != (sizeof(xPtrFeedbackCtl) >> 2))
return BadLength;
for (p = dev->ptrfeed; p; p = p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
ChangePtrFeedback(client, dev, stuff->mask, p,
(xPtrFeedbackCtl *) & stuff[1]);
return Success;
}
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id)
return ChangePtrFeedback(client, dev, stuff->mask, p,
(xPtrFeedbackCtl *) & stuff[1]);
break;
case StringFeedbackClass:
{
@ -526,63 +480,46 @@ ProcXChangeFeedbackControl(ClientPtr client)
if (client->swapped) {
swaps(&f->num_keysyms, n);
}
if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms))
return BadLength;
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;
}
if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id)
return ChangeStringFeedback(client, dev, stuff->mask, s,
(xStringFeedbackCtl *) & stuff[1]);
break;
}
case IntegerFeedbackClass:
if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
if (len != (sizeof(xIntegerFeedbackCtl) >> 2))
return BadLength;
for (i = dev->intfeed; i; i = i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
ChangeIntegerFeedback(client, dev, stuff->mask, i,
(xIntegerFeedbackCtl *) & stuff[1]);
return Success;
}
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
(xIntegerFeedbackCtl *)&stuff[1]);
break;
case LedFeedbackClass:
if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
if (len != (sizeof(xLedFeedbackCtl) >> 2))
return BadLength;
for (l = dev->leds; l; l = l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
ChangeLedFeedback(client, dev, stuff->mask, l,
(xLedFeedbackCtl *) & stuff[1]);
return Success;
}
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id)
return ChangeLedFeedback(client, dev, stuff->mask, l,
(xLedFeedbackCtl *) & stuff[1]);
break;
case BellFeedbackClass:
if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
0, BadLength);
return Success;
}
if (len != (sizeof(xBellFeedbackCtl) >> 2))
return BadLength;
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;
}
if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id)
return ChangeBellFeedback(client, dev, stuff->mask, b,
(xBellFeedbackCtl *) & stuff[1]);
break;
default:
break;
}
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
return Success;
return BadMatch;
}

View File

@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "globals.h"
#include "extnsionst.h"
#include "exevents.h"
#include "exglobals.h"
@ -98,10 +95,8 @@ SProcXChangeKeyboardDevice(ClientPtr client)
int
ProcXChangeKeyboardDevice(ClientPtr client)
{
REQUEST(xChangeKeyboardDeviceReq);
/* REQUEST(xChangeKeyboardDeviceReq); */
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
return Success;
return BadDevice;
}

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -111,18 +108,13 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes,
stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]);
if (ret != Success)
SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, ret);
return Success;
return ret;
}

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
@ -115,30 +112,22 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) +
stuff->count) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadLength);
return Success;
}
stuff->count)
return BadLength;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
rc);
return Success;
}
if (rc != Success)
return rc;
if (stuff->mode != AddToList && stuff->mode != DeleteFromList) {
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadMode);
return Success;
return BadMode;
}
if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_ChangeDeviceDontPropagateList) != Success)
return Success;
if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_ChangeDeviceDontPropagateList)) != Success)
return rc;
others = wOtherInputMasks(pWin);
if (!others && stuff->mode == DeleteFromList)
@ -153,11 +142,8 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
tmp[i].mask |= others->dontPropagateMask[i];
if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
Success) {
SendErrorToClient(client, IReqCode,
X_ChangeDeviceDontPropagateList, 0, BadClass);
return Success;
}
Success)
return BadClass;
}
return Success;

View File

@ -56,8 +56,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
@ -65,7 +63,6 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "dixevents.h"
@ -101,10 +98,8 @@ SProcXChangePointerDevice(ClientPtr client)
int
ProcXChangePointerDevice(ClientPtr client)
{
REQUEST(xChangePointerDeviceReq);
/* REQUEST(xChangePointerDeviceReq); */
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
return Success;
return BadDevice;
}

View File

@ -56,15 +56,12 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -151,10 +148,8 @@ ProcXCloseDevice(ClientPtr client)
REQUEST_SIZE_MATCH(xCloseDeviceReq);
d = LookupDeviceIntRec(stuff->deviceid);
if (d == NULL) {
SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
return Success;
}
if (d == NULL)
return BadDevice;
if (d->grab && SameClient(d->grab, client))
(*d->DeactivateGrab) (d); /* release active grab */

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -108,14 +105,12 @@ ProcXDeviceBell(ClientPtr client)
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
client->errorValue = stuff->deviceid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
return Success;
return BadDevice;
}
if (stuff->percent < -100 || stuff->percent > 100) {
client->errorValue = stuff->percent;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
return BadValue;
}
if (stuff->feedbackclass == KbdFeedbackClass) {
for (k = dev->kbdfeed; k; k = k->next)
@ -123,8 +118,7 @@ ProcXDeviceBell(ClientPtr client)
break;
if (!k) {
client->errorValue = stuff->feedbackid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
return BadValue;
}
base = k->ctrl.bell;
proc = k->BellProc;
@ -136,8 +130,7 @@ ProcXDeviceBell(ClientPtr client)
break;
if (!b) {
client->errorValue = stuff->feedbackid;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
return BadValue;
}
base = b->ctrl.percent;
proc = b->BellProc;
@ -145,8 +138,7 @@ ProcXDeviceBell(ClientPtr client)
class = BellFeedbackClass;
} else {
client->errorValue = stuff->feedbackclass;
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
return Success;
return BadValue;
}
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)

View File

@ -58,8 +58,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
@ -289,9 +287,7 @@ ProcIDispatch(ClientPtr client)
return (ProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl)
return (ProcXChangeDeviceControl(client));
else {
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return (BadRequest);
}
@ -378,9 +374,7 @@ SProcIDispatch(ClientPtr client)
return (SProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl)
return (SProcXChangeDeviceControl(client));
else {
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return (BadRequest);
}

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -106,18 +103,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
b = dev->button;
if (b == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
BadMatch);
return Success;
}
if (b == NULL)
return BadMatch;
rep.nElts = b->numButtons;
rep.length = (rep.nElts + (4 - 1)) / 4;
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -250,10 +247,8 @@ ProcXGetDeviceControl(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
@ -262,29 +257,20 @@ ProcXGetDeviceControl(ClientPtr client)
switch (stuff->control) {
case DEVICE_RESOLUTION:
if (!dev->valuator) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
if (!dev->valuator)
return BadMatch;
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
case DEVICE_ABS_CALIB:
if (!dev->absolute) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
if (!dev->absolute)
return BadMatch;
total_length = sizeof(xDeviceAbsCalibCtl);
break;
case DEVICE_ABS_AREA:
if (!dev->absolute) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
if (!dev->absolute)
return BadMatch;
total_length = sizeof(xDeviceAbsAreaCtl);
break;
@ -295,15 +281,12 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceEnableCtl);
break;
default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success;
return BadValue;
}
buf = (char *)xalloc(total_length);
if (!buf) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc);
return Success;
}
if (!buf)
return BadAlloc;
savbuf = buf;
switch (stuff->control) {

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -308,10 +305,8 @@ ProcXGetFeedbackControl(ClientPtr client)
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_GetFeedbackControl;
@ -345,16 +340,12 @@ ProcXGetFeedbackControl(ClientPtr client)
total_length += sizeof(xBellFeedbackState);
}
if (total_length == 0) {
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch);
return Success;
}
if (total_length == 0)
return BadMatch;
buf = (char *)xalloc(total_length);
if (!buf) {
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc);
return Success;
}
if (!buf)
return BadAlloc;
savbuf = buf;
for (k = dev->kbdfeed; k; k = k->next)

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -101,10 +98,8 @@ ProcXGetDeviceFocus(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL || !dev->focus) {
SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
return Success;
}
if (dev == NULL || !dev->focus)
return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus;

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
@ -102,29 +99,21 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
BadDevice);
return Success;
}
if (dev->key == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch);
return Success;
}
if (dev == NULL)
return BadDevice;
if (dev->key == NULL)
return BadMatch;
k = &dev->key->curKeySyms;
if ((stuff->firstKeyCode < k->minKeyCode) ||
(stuff->firstKeyCode > k->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
return Success;
return BadValue;
}
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) {
client->errorValue = stuff->count;
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
return Success;
return BadValue;
}
rep.repType = X_Reply;

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* Request macro */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -102,18 +99,13 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
kp = dev->key;
if (kp == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
BadMatch);
return Success;
}
if (kp == NULL)
return BadMatch;
maxkeys = kp->maxKeysPerModifier;
rep.repType = X_Reply;

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
@ -116,11 +113,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
rep.count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
rc);
return Success;
}
if (rc != Success)
return rc;
if ((others = wOtherInputMasks(pWin)) != 0) {
for (i = 0; i < EMASKSIZE; i++)

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
@ -118,11 +115,8 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
rep.all_clients_count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
rc);
return Success;
}
if (rc != Success)
return rc;
if ((pOthers = wOtherInputMasks(pWin)) != 0) {
for (others = pOthers->inputClients; others; others = others->next)

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -102,11 +99,8 @@ ProcXGetExtensionVersion(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (stuff->length != (sizeof(xGetExtensionVersionReq) +
stuff->nbytes + 3) >> 2) {
SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
BadLength);
return Success;
}
stuff->nbytes + 3) >> 2)
return BadLength;
rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion;

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
@ -109,7 +106,7 @@ SProcXGrabDevice(ClientPtr client)
int
ProcXGrabDevice(ClientPtr client)
{
int error;
int rc;
xGrabDeviceReply rep;
DeviceIntPtr dev;
struct tmask tmp[EMASKSIZE];
@ -117,10 +114,8 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) {
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadLength);
return Success;
}
if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
return BadLength;
rep.repType = X_Reply;
rep.RepType = X_GrabDevice;
@ -128,25 +123,22 @@ ProcXGrabDevice(ClientPtr client)
rep.length = 0;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->event_count, tmp, dev,
X_GrabDevice) != Success)
return Success;
if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->event_count, tmp, dev,
X_GrabDevice)) != Success)
return rc;
error = GrabDevice(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
tmp[stuff->deviceid].mask, &rep.status);
rc = GrabDevice(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
tmp[stuff->deviceid].mask, &rep.status);
if (rc != Success)
return rc;
if (error != Success) {
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
return Success;
}
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
}
@ -172,15 +164,12 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
for (i = 0; i < count; i++, list++) {
device = *list >> 8;
if (device > 255) {
SendErrorToClient(client, IReqCode, req, 0, BadClass);
if (device > 255)
return BadClass;
}
tdev = LookupDeviceIntRec(device);
if (tdev == NULL || (dev != NULL && tdev != dev)) {
SendErrorToClient(client, IReqCode, req, 0, BadClass);
if (tdev == NULL || (dev != NULL && tdev != dev))
return BadClass;
}
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff)) {

View File

@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -117,28 +114,19 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=
(sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) {
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength);
return Success;
}
(sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count)
return BadLength;
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadDevice);
return Success;
}
if (mdev->key == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
BadMatch);
return Success;
}
if (mdev == NULL)
return BadDevice;
if (mdev->key == NULL)
return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
@ -147,13 +135,11 @@ ProcXGrabDeviceButton(ClientPtr client)
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev,
X_GrabDeviceButton)) != Success)
return Success;
return ret;
ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev,
stuff->button, stuff->grabWindow, stuff->ownerEvents,
(Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask);
if (ret != Success)
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
return (Success);
return ret;
}

View File

@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -115,27 +112,19 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) {
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadLength);
return Success;
}
if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count)
return BadLength;
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
return Success;
}
if (mdev->key == NULL) {
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadMatch);
return Success;
}
if (mdev == NULL)
return BadDevice;
if (mdev->key == NULL)
return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
@ -144,17 +133,12 @@ ProcXGrabDeviceKey(ClientPtr client)
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev,
X_GrabDeviceKey)) != Success)
return Success;
return ret;
ret = GrabKey(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev,
stuff->key, stuff->grabWindow, stuff->ownerEvents,
tmp[stuff->grabbed_device].mask);
if (ret != Success) {
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
return Success;
}
return Success;
return ret;
}

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -110,17 +107,11 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
v = dev->valuator;
if (v == NULL || v->numAxes == 0) {
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadMatch);
return Success;
}
if (v == NULL || v->numAxes == 0)
return BadMatch;
if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client);
axes = v->numAxes;
@ -145,11 +136,8 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
size = sizeof(Time) + (axes * sizeof(INT32));
tsize = num_events * size;
coords = (INT32 *) ALLOCATE_LOCAL(tsize);
if (!coords) {
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
BadAlloc);
return Success;
}
if (!coords)
return BadAlloc;
rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL);

View File

@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "windowstr.h" /* window structure */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -107,26 +104,20 @@ ProcXOpenDevice(ClientPtr client)
REQUEST_SIZE_MATCH(xOpenDeviceReq);
if (stuff->deviceid == inputInfo.pointer->id ||
stuff->deviceid == inputInfo.keyboard->id) {
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success;
}
stuff->deviceid == inputInfo.keyboard->id)
return BadDevice;
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */
for (dev = inputInfo.off_devices; dev; dev = dev->next)
if (dev->id == stuff->deviceid)
break;
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
}
OpenInputDevice(dev, client, &status);
if (status != Success) {
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
return Success;
}
if (status != Success)
return status;
rep.repType = X_Reply;
rep.RepType = X_OpenDevice;

View File

@ -38,13 +38,10 @@ from The Open Group.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -100,10 +97,8 @@ ProcXQueryDeviceState(ClientPtr client)
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
v = dev->valuator;
if (v != NULL && v->motionHintWindow != NULL)
@ -126,10 +121,8 @@ ProcXQueryDeviceState(ClientPtr client)
num_classes++;
}
buf = (char *)xalloc(total_length);
if (!buf) {
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc);
return Success;
}
if (!buf)
return BadAlloc;
savbuf = buf;
if (k != NULL) {

View File

@ -57,13 +57,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -164,40 +161,29 @@ ProcXSelectExtensionEvent(ClientPtr client)
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadLength);
return Success;
}
if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count)
return BadLength;
ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (ret != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret);
return Success;
}
if (ret != Success)
return ret;
if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
&stuff->count) != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadAlloc);
return Success;
}
&stuff->count) != Success)
return BadAlloc;
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_SelectExtensionEvent)) != Success)
return Success;
return ret;
for (i = 0; i < EMASKSIZE; i++)
if (tmp[i].dev != NULL) {
if ((ret =
SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
tmp[i].mask, ExtExclusiveMasks[i],
ExtValidMasks[i])) != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
ret);
return Success;
}
ExtValidMasks[i])) != Success)
return ret;
}
return Success;

View File

@ -57,13 +57,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* Window */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -131,38 +128,29 @@ ProcXSendExtensionEvent(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
(stuff->num_events * (sizeof(xEvent) >> 2))) {
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadLength);
return Success;
}
(stuff->num_events * (sizeof(xEvent) >> 2)))
return BadLength;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
/* The client's event type must be one defined by an extension. */
first = ((xEvent *) & stuff[1]);
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
(first->u.u.type < lastEvent))) {
(first->u.u.type < lastEvent)))
client->errorValue = first->u.u.type;
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadValue);
return Success;
}
return BadValue;
list = (XEventClass *) (first + stuff->num_events);
if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
X_SendExtensionEvent)) != Success)
return Success;
return ret;
ret = (SendEvent(client, dev, stuff->destination,
stuff->propagate, (xEvent *) & stuff[1],
tmp[stuff->deviceid].mask, stuff->num_events));
if (ret != Success)
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
return Success;
return ret;
}

View File

@ -59,13 +59,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -104,11 +101,8 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
stuff->map_length + 3) >> 2) {
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
BadLength);
return Success;
}
stuff->map_length + 3) >> 2)
return BadLength;
rep.repType = X_Reply;
rep.RepType = X_SetDeviceButtonMapping;
@ -117,18 +111,14 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
rep.status = MappingSuccess;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]);
if (ret == BadValue || ret == BadMatch) {
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, ret);
return Success;
} else {
if (ret == BadValue || ret == BadMatch)
return ret;
else {
rep.status = ret;
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
}

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -106,24 +103,17 @@ ProcXSetDeviceValuators(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) +
stuff->num_valuators) {
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadLength);
return Success;
}
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice);
return Success;
}
if (dev->valuator == NULL) {
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch);
return Success;
}
stuff->num_valuators)
return BadLength;
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) {
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue);
return Success;
}
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
return BadDevice;
if (dev->valuator == NULL)
return BadMatch;
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
return BadValue;
if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed;
@ -133,11 +123,9 @@ ProcXSetDeviceValuators(ClientPtr client)
stuff->num_valuators);
if (rep.status != Success && rep.status != AlreadyGrabbed)
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
rep.status);
else
WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
return rep.status;
WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
return Success;
}

View File

@ -56,8 +56,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -65,7 +63,6 @@ SOFTWARE.
#include "dixevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -106,15 +103,11 @@ ProcXSetDeviceFocus(ClientPtr client)
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
dev = LookupDeviceIntRec(stuff->device);
if (dev == NULL || !dev->focus) {
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
return Success;
}
if (dev == NULL || !dev->focus)
return BadDevice;
ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo,
stuff->time, TRUE);
if (ret != Success)
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
return Success;
return ret;
}

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -103,11 +100,8 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0,
BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_SetDeviceModifierMapping;
@ -125,11 +119,8 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
&rep);
} else {
if (ret == -1)
ret = BadValue;
SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret);
}
} else if (ret == -1)
return BadValue;
return Success;
}

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -105,14 +102,10 @@ ProcXSetDeviceMode(ClientPtr client)
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice);
return Success;
}
if (dev->valuator == NULL) {
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
return Success;
}
if (dev == NULL)
return BadDevice;
if (dev->valuator == NULL)
return BadMatch;
if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed;
else
@ -120,10 +113,8 @@ ProcXSetDeviceMode(ClientPtr client)
if (rep.status == Success)
dev->valuator->mode = stuff->mode;
else if (rep.status != AlreadyGrabbed) {
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
return Success;
}
else if (rep.status != AlreadyGrabbed)
return rep.status;
WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
return Success;

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@ -102,10 +99,8 @@ ProcXUngrabDevice(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
return Success;
}
if (dev == NULL)
return BadDevice;
grab = dev->grab;
time = ClientTimeToServerTime(stuff->time);

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
@ -111,41 +108,27 @@ ProcXUngrabDeviceButton(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice);
return Success;
}
if (dev->button == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch);
return Success;
}
if (dev == NULL)
return BadDevice;
if (dev->button == NULL)
return BadMatch;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadDevice);
return Success;
}
if (mdev->key == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
BadMatch);
return Success;
}
if (mdev == NULL)
return BadDevice;
if (mdev->key == NULL)
return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, rc);
return Success;
}
if (rc != Success)
return rc;
if ((stuff->modifiers != AnyModifier) &&
(stuff->modifiers & ~AllModifiersMask)) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadValue);
return Success;
}
(stuff->modifiers & ~AllModifiersMask))
return BadValue;
temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev;

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
@ -111,45 +108,32 @@ ProcXUngrabDeviceKey(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
dev = LookupDeviceIntRec(stuff->grabbed_device);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice);
return Success;
}
if (dev->key == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
return Success;
}
if (dev == NULL)
return BadDevice;
if (dev->key == NULL)
return BadMatch;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
if (mdev == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
BadDevice);
return Success;
}
if (mdev->key == NULL) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
return Success;
}
if (mdev == NULL)
return BadDevice;
if (mdev->key == NULL)
return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc);
return Success;
}
if (rc != Success)
return rc;
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
(stuff->key < dev->key->curKeySyms.minKeyCode))
&& (stuff->key != AnyKey)) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
return Success;
}
&& (stuff->key != AnyKey))
return BadValue;
if ((stuff->modifiers != AnyModifier) &&
(stuff->modifiers & ~AllModifiersMask)) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
return Success;
}
(stuff->modifiers & ~AllModifiersMask))
return BadValue;
temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev;