summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-11-07 15:37:23 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-11-07 15:37:23 +1030
commit0b729051c04da7068f1e6dd319190bd0a362b2c0 (patch)
tree6e15c5de67a40d04167fcf0a2e0e26af8eca11c2 /Xi
parentb7ee005d327372c1e414ee6c526f9f7aee14bc86 (diff)
parentd7c5e8bfc1aecbd23a4cbb2eab08656587aac2e8 (diff)
Merge branch 'master' into mpx
Conflicts: Xi/extinit.c Xi/grabdev.c Xi/setmode.c Xi/ungrdev.c dix/devices.c dix/events.c dix/getevents.c include/dix.h mi/midispcur.c mi/misprite.c xkb/xkbActions.c xkb/xkbEvents.c xkb/xkbPrKeyEv.c
Diffstat (limited to 'Xi')
-rw-r--r--Xi/allowev.c12
-rw-r--r--Xi/chgdctl.c15
-rw-r--r--Xi/chgfctl.c179
-rw-r--r--Xi/chgkbd.c9
-rw-r--r--Xi/chgkmap.c14
-rw-r--r--Xi/chgprop.c36
-rw-r--r--Xi/chgptr.c9
-rw-r--r--Xi/closedev.c9
-rw-r--r--Xi/devbell.c18
-rw-r--r--Xi/exevents.c13
-rw-r--r--Xi/extinit.c3
-rw-r--r--Xi/getbmap.c18
-rw-r--r--Xi/getdctl.c39
-rw-r--r--Xi/getfctl.c21
-rw-r--r--Xi/getfocus.c9
-rw-r--r--Xi/getkmap.c23
-rw-r--r--Xi/getmmap.c18
-rw-r--r--Xi/getprop.c10
-rw-r--r--Xi/getselev.c10
-rw-r--r--Xi/getvers.c10
-rw-r--r--Xi/grabdev.c49
-rw-r--r--Xi/grabdevb.c36
-rw-r--r--Xi/grabdevk.c36
-rw-r--r--Xi/gtmotion.c28
-rw-r--r--Xi/opendev.c21
-rw-r--r--Xi/queryst.c15
-rw-r--r--Xi/selectev.c32
-rw-r--r--Xi/sendexev.c28
-rw-r--r--Xi/setbmap.c26
-rw-r--r--Xi/setdval.c36
-rw-r--r--Xi/setfocus.c13
-rw-r--r--Xi/setmmap.c19
-rw-r--r--Xi/setmode.c21
-rw-r--r--Xi/ungrdev.c9
-rw-r--r--Xi/ungrdevb.c41
-rw-r--r--Xi/ungrdevk.c48
36 files changed, 281 insertions, 652 deletions
diff --git a/Xi/allowev.c b/Xi/allowev.c
index 449d8811a..12aeab3a9 100644
--- a/Xi/allowev.c
+++ b/Xi/allowev.c
@@ -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, FALSE);
break;
default:
- SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue);
client->errorValue = stuff->mode;
- return Success;
+ return BadValue;
}
return Success;
}
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index def3b702d..8aef00db2 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -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;
}
/***********************************************************************
diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c
index 2e0e13cad..46bb8e78f 100644
--- a/Xi/chgfctl.c
+++ b/Xi/chgfctl.c
@@ -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;
}
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index 2cf8225b3..83de646f1 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -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;
}
diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c
index eac520fd4..bfdc1cedc 100644
--- a/Xi/chgkmap.c
+++ b/Xi/chgkmap.c
@@ -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;
}
diff --git a/Xi/chgprop.c b/Xi/chgprop.c
index 59a93c60b..13463dd1c 100644
--- a/Xi/chgprop.c
+++ b/Xi/chgprop.c
@@ -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;
diff --git a/Xi/chgptr.c b/Xi/chgptr.c
index a94906866..2ce81d1d6 100644
--- a/Xi/chgptr.c
+++ b/Xi/chgptr.c
@@ -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;
}
diff --git a/Xi/closedev.c b/Xi/closedev.c
index 8aebe1043..cd6e53740 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -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->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
(*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
diff --git a/Xi/devbell.c b/Xi/devbell.c
index ba873c7c7..83e844d93 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -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)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 1bcc101a7..fd3d3ad76 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -74,6 +74,10 @@ SOFTWARE.
#include "dixgrabs.h" /* CreateGrab() */
#include "scrnintstr.h"
+#ifdef XKB
+#include "xkbsrv.h"
+#endif
+
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
@@ -1004,7 +1008,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen,
}
void
-SendDeviceMappingNotify(CARD8 request,
+SendDeviceMappingNotify(ClientPtr client, CARD8 request,
KeyCode firstKeyCode, CARD8 count, DeviceIntPtr dev)
{
xEvent event;
@@ -1019,6 +1023,11 @@ SendDeviceMappingNotify(CARD8 request,
ev->count = count;
}
+#ifdef XKB
+ if (request == MappingKeyboard || request == MappingModifier)
+ XkbApplyMappingChange(dev, request, firstKeyCode, count, client);
+#endif
+
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1);
}
@@ -1054,7 +1063,7 @@ ChangeKeyMapping(ClientPtr client,
keysyms.map = map;
if (!SetKeySymsMap(&k->curKeySyms, &keysyms))
return BadAlloc;
- SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, dev);
+ SendDeviceMappingNotify(client, MappingKeyboard, firstKeyCode, keyCodes, dev);
return client->noClientException;
}
diff --git a/Xi/extinit.c b/Xi/extinit.c
index c1b6eedae..3b384eee3 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -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 */
@@ -1213,6 +1211,7 @@ XInputExtensionInit(void)
EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+ EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
EventSwapVector[DeviceEnterNotify] = SEventIDispatch;
EventSwapVector[DeviceLeaveNotify] = SEventIDispatch;
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index 5e8cf07fb..ebb0613af 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -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);
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 88f061ee0..8a84e91bc 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -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) {
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 5ca90dbf0..7dff32f4f 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -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)
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index 245b5f1b4..073913bf2 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.c
@@ -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;
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 989f3d57d..eaa0cffcc 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -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;
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 038937ef7..8a99d63ed 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -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;
diff --git a/Xi/getprop.c b/Xi/getprop.c
index 6fa1986f4..531e65f27 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -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++)
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 9c5f2191c..819b2dbd0 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -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)
diff --git a/Xi/getvers.c b/Xi/getvers.c
index b3f4c1c67..a223a5d1e 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -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;
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index f2227bcf1..16f4b7ea2 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -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, FALSE);
+ rc = GrabDevice(client, dev, stuff->this_device_mode,
+ stuff->other_devices_mode, stuff->grabWindow,
+ stuff->ownerEvents, stuff->time,
+ tmp[stuff->deviceid].mask, &rep.status, FALSE);
+
+ if (rc != Success)
+ return rc;
- if (error != Success) {
- SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
- return Success;
- }
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
}
@@ -190,15 +182,12 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
for (i = 0; i < count; i++, list++) {
device = *list >> 8;
- if (device > 255) { /* FIXME: we only use 7 bit for devices? */
- SendErrorToClient(client, IReqCode, req, 0, BadClass);
+ if (device > 255) /* FIXME: we only use 7 bit for devices? */
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)) {
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index 0b8a978e7..7ef8ad774 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -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 = PickKeyboard(client);
@@ -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;
}
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index 297072b6f..d38c053f0 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -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 = PickKeyboard(client);
@@ -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;
}
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index cfc7f89f3..ad2bec391 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -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;
@@ -144,12 +135,9 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
if (num_events) {
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;
- }
+ coords = (INT32 *) xalloc(tsize);
+ if (!coords)
+ return BadAlloc;
rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL);
@@ -173,7 +161,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
WriteToClient(client, length * 4, (char *)coords);
}
if (coords)
- DEALLOCATE_LOCAL(coords);
+ xfree(coords);
return Success;
}
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 0b0671d49..dfefe055c 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -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;
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 972cd2c80..2b66b7eb2 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -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) {
diff --git a/Xi/selectev.c b/Xi/selectev.c
index d52db1b81..a5cf56754 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -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;
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
index eac9abe14..20b415a1f 100644
--- a/Xi/sendexev.c
+++ b/Xi/sendexev.c
@@ -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;
}
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index bdfa513dd..40f0f9a99 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -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,24 +111,20 @@ 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);
}
if (ret != MappingBusy)
- SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
+ SendDeviceMappingNotify(client, MappingPointer, 0, 0, dev);
return Success;
}
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 61b98c790..bbab34e33 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -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;
- }
+ stuff->num_valuators)
+ return BadLength;
+
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice);
- return Success;
- }
- if (dev->valuator == NULL) {
- SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch);
- return Success;
- }
-
- if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) {
- SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
+ if (dev->valuator == NULL)
+ return BadMatch;
+
+ if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
+ return BadValue;
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.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;
}
diff --git a/Xi/setfocus.c b/Xi/setfocus.c
index aaf88ce6f..74de17e97 100644
--- a/Xi/setfocus.c
+++ b/Xi/setfocus.c
@@ -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;
}
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index 00784995a..19ec71bbe 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.c
@@ -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;
@@ -122,14 +116,11 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
rep.success = ret;
if (ret == MappingSuccess)
- SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
+ 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;
}
diff --git a/Xi/setmode.c b/Xi/setmode.c
index 00d340055..d8a569588 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -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->deviceGrab.grab) && !SameClient(dev->deviceGrab.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;
diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c
index e056ce688..3b6b252b6 100644
--- a/Xi/ungrdev.c
+++ b/Xi/ungrdev.c
@@ -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->deviceGrab.grab;
time = ClientTimeToServerTime(stuff->time);
diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c
index 5e0a66328..46d325044 100644
--- a/Xi/ungrdevb.c
+++ b/Xi/ungrdevb.c
@@ -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 = PickKeyboard(client);
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;
diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c
index 7b06d6e09..7df4095c9 100644
--- a/Xi/ungrdevk.c
+++ b/Xi/ungrdevk.c
@@ -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 = PickKeyboard(client);
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;