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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,15 +56,12 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <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 <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -151,10 +148,8 @@ ProcXCloseDevice(ClientPtr client)
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); return BadDevice;
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 */

View File

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

View File

@ -58,8 +58,6 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h>
#include <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 */
@ -289,9 +287,7 @@ ProcIDispatch(ClientPtr client)
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 {
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return (BadRequest); return (BadRequest);
} }
@ -378,9 +374,7 @@ SProcIDispatch(ClientPtr client)
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 {
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
}
return (BadRequest); return (BadRequest);
} }

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -106,18 +103,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
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, return BadDevice;
BadDevice);
return Success;
}
b = dev->button; b = dev->button;
if (b == NULL) { if (b == NULL)
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, return BadMatch;
BadMatch);
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);

View File

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

View File

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

View File

@ -56,13 +56,10 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */ #include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -101,10 +98,8 @@ ProcXGetDeviceFocus(ClientPtr client)
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); return BadDevice;
return Success;
}
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus; rep.RepType = X_GetDeviceFocus;

View File

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

View File

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

View File

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

View File

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

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -102,11 +99,8 @@ ProcXGetExtensionVersion(ClientPtr client)
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, return BadLength;
BadLength);
return Success;
}
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion; rep.RepType = X_GetExtensionVersion;

View File

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

View File

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

View File

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

View File

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

View File

@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -107,26 +104,20 @@ ProcXOpenDevice(ClientPtr client)
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); return BadDevice;
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); return BadDevice;
return Success;
}
} }
OpenInputDevice(dev, client, &status); OpenInputDevice(dev, client, &status);
if (status != Success) { if (status != Success)
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status); return status;
return Success;
}
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_OpenDevice; rep.RepType = X_OpenDevice;

View File

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

View File

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

View File

@ -57,13 +57,10 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* Window */ #include "windowstr.h" /* Window */
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
@ -131,38 +128,29 @@ ProcXSendExtensionEvent(ClientPtr client)
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); return BadLength;
return Success;
}
dev = LookupDeviceIntRec(stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) { if (dev == NULL)
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice); return BadDevice;
return Success;
}
/* 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, BadValue); return BadValue;
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 ret;
ret = (SendEvent(client, dev, stuff->destination, ret = (SendEvent(client, dev, stuff->destination,
stuff->propagate, (xEvent *) & stuff[1], stuff->propagate, (xEvent *) & stuff[1],
tmp[stuff->deviceid].mask, stuff->num_events)); tmp[stuff->deviceid].mask, stuff->num_events));
if (ret != Success) return ret;
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
return Success;
} }

View File

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

View File

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

View File

@ -56,8 +56,6 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */ #include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
@ -65,7 +63,6 @@ SOFTWARE.
#include "dixevents.h" #include "dixevents.h"
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -106,15 +103,11 @@ ProcXSetDeviceFocus(ClientPtr client)
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); return BadDevice;
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)
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
return Success; return ret;
} }

View File

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

View File

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

View File

@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */ #include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */ #include "windowstr.h" /* window structure */
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
@ -102,10 +99,8 @@ ProcXUngrabDevice(ClientPtr client)
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); return BadDevice;
return Success;
}
grab = dev->grab; grab = dev->grab;
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);

View File

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

View File

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