From 31a7994ac7365562ef1d00e0a7b25f967a961a4e Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Mon, 24 Sep 2007 13:33:01 -0400 Subject: Input: Return errors to the dispatcher instead of sending them ourself. Also fixed two "unused variable: stuff" warnings. --- Xi/ungrdevk.c | 48 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) (limited to 'Xi/ungrdevk.c') diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index d316990b2..e6307af01 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -56,13 +56,10 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include -#include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" @@ -111,45 +108,32 @@ ProcXUngrabDeviceKey(ClientPtr client) REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice); - return Success; - } - if (dev->key == NULL) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); - return Success; - } + if (dev == NULL) + return BadDevice; + if (dev->key == NULL) + return BadMatch; if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, - BadDevice); - return Success; - } - if (mdev->key == NULL) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); - return Success; - } + if (mdev == NULL) + return BadDevice; + if (mdev->key == NULL) + return BadMatch; } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); - if (rc != Success) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc); - return Success; - } + if (rc != Success) + return rc; + if (((stuff->key > dev->key->curKeySyms.maxKeyCode) || (stuff->key < dev->key->curKeySyms.minKeyCode)) - && (stuff->key != AnyKey)) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue); - return Success; - } + && (stuff->key != AnyKey)) + return BadValue; + if ((stuff->modifiers != AnyModifier) && - (stuff->modifiers & ~AllModifiersMask)) { - SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue); - return Success; - } + (stuff->modifiers & ~AllModifiersMask)) + return BadValue; temporaryGrab.resource = client->clientAsMask; temporaryGrab.device = dev; -- cgit v1.2.3