summaryrefslogtreecommitdiff
path: root/Xi/grabdev.c
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/grabdev.c
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/grabdev.c')
-rw-r--r--Xi/grabdev.c49
1 files changed, 19 insertions, 30 deletions
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)) {