diff --git a/src/XAllowDv.c b/src/XAllowDv.c index 7fd2a07..c4a786b 100644 --- a/src/XAllowDv.c +++ b/src/XAllowDv.c @@ -71,8 +71,11 @@ XAllowDeviceEvents(dpy, dev, event_mode, XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(AllowDeviceEvents, req); req->reqType = info->codes->major_opcode; diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c index 9e71475..5f1b087 100644 --- a/src/XChgDCtl.c +++ b/src/XChgDCtl.c @@ -71,11 +71,15 @@ XChangeDeviceControl(dpy, dev, control, int length; xChangeDeviceControlReq *req; xChangeDeviceControlReply rep; + int status = NoSuchExtension; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(ChangeDeviceControl, req); req->reqType = info->codes->major_opcode; @@ -100,12 +104,10 @@ XChangeDeviceControl(dpy, dev, control, Data(dpy, (char *)&r, length); length = r.num_valuators * sizeof(int); Data(dpy, (char *)R->resolutions, length); - if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (NoSuchExtension); - } else - return (rep.status); + if (_XReply(dpy, (xReply *) & rep, 0, xTrue)) { + status = rep.status; + } + break; } case DEVICE_TOUCHSCREEN: { @@ -123,14 +125,10 @@ XChangeDeviceControl(dpy, dev, control, req->length += (sizeof(t) + 3) >> 2; Data(dpy, (char *) &t, sizeof(t)); - if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return NoSuchExtension; - } - else { - return rep.status; + if (_XReply(dpy, (xReply *) &rep, 0, xTrue)) { + status = rep.status } + break; } case DEVICE_CORE: { @@ -144,14 +142,10 @@ XChangeDeviceControl(dpy, dev, control, req->length += (sizeof(c) + 3) >> 2; Data (dpy, (char *) &c, sizeof(c)); - if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return NoSuchExtension; - } - else { - return rep.status; + if (_XReply(dpy, (xReply *) &rep, 0, xTrue)) { + status = rep.status; } + break; } default: { @@ -163,10 +157,11 @@ XChangeDeviceControl(dpy, dev, control, req->length += length; length <<= 2; Data(dpy, (char *)&u, length); + status = Success; } } UnlockDisplay(dpy); SyncHandle(); - return (Success); + return (status); } diff --git a/src/XChgFCtl.c b/src/XChgFCtl.c index e499b41..74e5c40 100644 --- a/src/XChgFCtl.c +++ b/src/XChgFCtl.c @@ -73,8 +73,11 @@ XChangeFeedbackControl(dpy, dev, mask, f XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(ChangeFeedbackControl, req); req->reqType = info->codes->major_opcode; diff --git a/src/XChgKMap.c b/src/XChgKMap.c index 73de754..8447a39 100644 --- a/src/XChgKMap.c +++ b/src/XChgKMap.c @@ -74,8 +74,11 @@ XChangeDeviceKeyMapping(dpy, dev, first, XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(ChangeDeviceKeyMapping, req); req->reqType = info->codes->major_opcode; diff --git a/src/XChgKbd.c b/src/XChgKbd.c index 1b01207..6bfc251 100644 --- a/src/XChgKbd.c +++ b/src/XChgKbd.c @@ -70,8 +70,11 @@ XChangeKeyboardDevice(dpy, dev) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(ChangeKeyboardDevice, req); req->reqType = info->codes->major_opcode; diff --git a/src/XChgPnt.c b/src/XChgPnt.c index 6123398..a533871 100644 --- a/src/XChgPnt.c +++ b/src/XChgPnt.c @@ -72,8 +72,11 @@ XChangePointerDevice(dpy, dev, xaxis, ya XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(ChangePointerDevice, req); req->reqType = info->codes->major_opcode; diff --git a/src/XChgProp.c b/src/XChgProp.c index 0c7377f..1db6087 100644 --- a/src/XChgProp.c +++ b/src/XChgProp.c @@ -73,8 +73,11 @@ XChangeDeviceDontPropagateList(dpy, wind XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(ChangeDeviceDontPropagateList, req); req->reqType = info->codes->major_opcode; diff --git a/src/XCloseDev.c b/src/XCloseDev.c index ca19860..36a035c 100644 --- a/src/XCloseDev.c +++ b/src/XCloseDev.c @@ -69,8 +69,11 @@ XCloseDevice(dpy, dev) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(CloseDevice, req); req->reqType = info->codes->major_opcode; diff --git a/src/XDevBell.c b/src/XDevBell.c index 73f2e35..44a0b85 100644 --- a/src/XDevBell.c +++ b/src/XDevBell.c @@ -71,8 +71,11 @@ XDeviceBell(dpy, dev, feedbackclass, fee XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(DeviceBell, req); req->reqType = info->codes->major_opcode; diff --git a/src/XExtInt.c b/src/XExtInt.c index b7297dc..2bfa368 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -203,7 +203,6 @@ _XiCheckExtInit(dpy, version_index, info if (info->data == NULL) { info->data = (XPointer) Xmalloc(sizeof(XInputData)); if (!info->data) { - UnlockDisplay(dpy); return (-1); } ((XInputData *) info->data)->vers = @@ -215,7 +214,6 @@ _XiCheckExtInit(dpy, version_index, info if ((ext->major_version < versions[version_index].major_version) || ((ext->major_version == versions[version_index].major_version) && (ext->minor_version < versions[version_index].minor_version))) { - UnlockDisplay(dpy); return (-1); } } diff --git a/src/XGMotion.c b/src/XGMotion.c index daa8792..d7d17c2 100644 --- a/src/XGMotion.c +++ b/src/XGMotion.c @@ -85,8 +85,11 @@ Time stop; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XDeviceTimeCoord *) NoSuchExtension); + } GetReq(GetDeviceMotionEvents, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetBMap.c b/src/XGetBMap.c index 15cad74..440c34c 100644 --- a/src/XGetBMap.c +++ b/src/XGetBMap.c @@ -81,8 +81,12 @@ XGetDeviceButtonMapping(dpy, device, map xGetDeviceButtonMappingReply rep; LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } + GetReq(GetDeviceButtonMapping, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c index 8d034bf..cc44c97 100644 --- a/src/XGetDCtl.c +++ b/src/XGetDCtl.c @@ -78,8 +78,11 @@ XGetDeviceControl(dpy, dev, control) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XDeviceControl *) NoSuchExtension); + } GetReq(GetDeviceControl, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetFCtl.c b/src/XGetFCtl.c index af4578c..3e58ebe 100644 --- a/src/XGetFCtl.c +++ b/src/XGetFCtl.c @@ -78,8 +78,11 @@ XGetFeedbackControl(dpy, dev, num_feedba XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XFeedbackState *) NoSuchExtension); + } GetReq(GetFeedbackControl, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetKMap.c b/src/XGetKMap.c index 0381e86..67cb339 100644 --- a/src/XGetKMap.c +++ b/src/XGetKMap.c @@ -76,8 +76,11 @@ #endif XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((KeySym *) NoSuchExtension); + } GetReq(GetDeviceKeyMapping, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetMMap.c b/src/XGetMMap.c index ef92281..1822156 100644 --- a/src/XGetMMap.c +++ b/src/XGetMMap.c @@ -72,8 +72,11 @@ XGetDeviceModifierMapping(dpy, dev) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XModifierKeymap *) NoSuchExtension); + } GetReq(GetDeviceModifierMapping, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetProp.c b/src/XGetProp.c index 71d844b..fc3c95a 100644 --- a/src/XGetProp.c +++ b/src/XGetProp.c @@ -75,8 +75,11 @@ Window window; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XEventClass *) NoSuchExtension); + } GetReq(GetDeviceDontPropagateList, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGetVers.c b/src/XGetVers.c index d3c765a..7e750a4 100644 --- a/src/XGetVers.c +++ b/src/XGetVers.c @@ -67,11 +67,15 @@ XGetExtensionVersion(register Display * XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - ext = _XiGetExtensionVersion(dpy, name, info); - if (ext != (XExtensionVersion *) NoSuchExtension) { + if (_XiCheckExtInit(dpy, Dont_Check, info) == -1) { UnlockDisplay(dpy); SyncHandle(); + return (XExtensionVersion *) NULL; } + + ext = _XiGetExtensionVersion(dpy, name, info); + UnlockDisplay(dpy); + SyncHandle(); return (ext); } @@ -82,9 +86,6 @@ _XiGetExtensionVersion(register Display xGetExtensionVersionReply rep; XExtensionVersion *ext; - if (_XiCheckExtInit(dpy, Dont_Check, info) == -1) - return ((XExtensionVersion *) NoSuchExtension); - GetReq(GetExtensionVersion, req); req->reqType = info->codes->major_opcode; req->ReqType = X_GetExtensionVersion; diff --git a/src/XGrDvBut.c b/src/XGrDvBut.c index 6e35099..a2da116 100644 --- a/src/XGrDvBut.c +++ b/src/XGrDvBut.c @@ -80,8 +80,11 @@ XGrabDeviceButton(dpy, dev, button, modi XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(GrabDeviceButton, req); diff --git a/src/XGrDvKey.c b/src/XGrDvKey.c index 1389753..ef0253b 100644 --- a/src/XGrDvKey.c +++ b/src/XGrDvKey.c @@ -80,8 +80,11 @@ XGrabDeviceKey(dpy, dev, key, modifiers, XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(GrabDeviceKey, req); diff --git a/src/XGrabDev.c b/src/XGrabDev.c index 92f1c11..b70ce37 100644 --- a/src/XGrabDev.c +++ b/src/XGrabDev.c @@ -78,8 +78,11 @@ XGrabDevice(dpy, dev, grab_window, owner XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SynchHandle(); return (NoSuchExtension); + } GetReq(GrabDevice, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGtFocus.c b/src/XGtFocus.c index 4e63918..afaa6ff 100644 --- a/src/XGtFocus.c +++ b/src/XGtFocus.c @@ -73,8 +73,11 @@ XGetDeviceFocus(dpy, dev, focus, revert_ XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(GetDeviceFocus, req); req->reqType = info->codes->major_opcode; diff --git a/src/XGtSelect.c b/src/XGtSelect.c index 9f596fd..9ec98ba 100644 --- a/src/XGtSelect.c +++ b/src/XGtSelect.c @@ -76,10 +76,13 @@ XGetSelectedExtensionEvents(dpy, w, this XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); - GetReq(GetSelectedExtensionEvents, req); + } + GetReq(GetSelectedExtensionEvents, req); req->reqType = info->codes->major_opcode; req->ReqType = X_GetSelectedExtensionEvents; req->window = w; diff --git a/src/XListDev.c b/src/XListDev.c index b9a617d..37c5b0e 100644 --- a/src/XListDev.c +++ b/src/XListDev.c @@ -82,8 +82,11 @@ XListInputDevices(dpy, ndevices) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XDeviceInfo *) NULL); + } GetReq(ListInputDevices, req); req->reqType = info->codes->major_opcode; diff --git a/src/XOpenDev.c b/src/XOpenDev.c index d220330..7dcd15a 100644 --- a/src/XOpenDev.c +++ b/src/XOpenDev.c @@ -72,8 +72,11 @@ XOpenDevice(dpy, id) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XDevice *) NoSuchExtension); + } GetReq(OpenDevice, req); req->reqType = info->codes->major_opcode; diff --git a/src/XQueryDv.c b/src/XQueryDv.c index 540f224..b2f665d 100644 --- a/src/XQueryDv.c +++ b/src/XQueryDv.c @@ -76,8 +76,11 @@ XQueryDeviceState(dpy, dev) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return ((XDeviceState *) NoSuchExtension); + } GetReq(QueryDeviceState, req); req->reqType = info->codes->major_opcode; diff --git a/src/XSelect.c b/src/XSelect.c index af0fb84..4784520 100644 --- a/src/XSelect.c +++ b/src/XSelect.c @@ -71,10 +71,13 @@ XSelectExtensionEvent(dpy, w, event_list XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); - GetReq(SelectExtensionEvent, req); + } + GetReq(SelectExtensionEvent, req); req->reqType = info->codes->major_opcode; req->ReqType = X_SelectExtensionEvent; req->window = w; diff --git a/src/XSetBMap.c b/src/XSetBMap.c index cad6976..de22eb1 100644 --- a/src/XSetBMap.c +++ b/src/XSetBMap.c @@ -75,8 +75,12 @@ XSetDeviceButtonMapping(dpy, device, map XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } + GetReq(SetDeviceButtonMapping, req); req->reqType = info->codes->major_opcode; req->ReqType = X_SetDeviceButtonMapping; diff --git a/src/XSetDVal.c b/src/XSetDVal.c index 43702b0..bbff59f 100644 --- a/src/XSetDVal.c +++ b/src/XSetDVal.c @@ -74,8 +74,11 @@ XSetDeviceValuators(dpy, dev, valuators, XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(SetDeviceValuators, req); req->reqType = info->codes->major_opcode; diff --git a/src/XSetMMap.c b/src/XSetMMap.c index 1077433..4e4964d 100644 --- a/src/XSetMMap.c +++ b/src/XSetMMap.c @@ -72,8 +72,11 @@ XSetDeviceModifierMapping(dpy, dev, modm XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReqExtra(SetDeviceModifierMapping, mapSize, req); req->reqType = info->codes->major_opcode; diff --git a/src/XSetMode.c b/src/XSetMode.c index 94e2b3d..29ae511 100644 --- a/src/XSetMode.c +++ b/src/XSetMode.c @@ -71,8 +71,11 @@ XSetDeviceMode(dpy, dev, mode) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(SetDeviceMode, req); req->reqType = info->codes->major_opcode; diff --git a/src/XSndExEv.c b/src/XSndExEv.c index 71431cd..69dd779 100644 --- a/src/XSndExEv.c +++ b/src/XSndExEv.c @@ -81,8 +81,11 @@ XSendExtensionEvent(dpy, dev, dest, prop XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } /* call through display to find proper conversion routine */ diff --git a/src/XUngrDev.c b/src/XUngrDev.c index 70ba03d..5e9d0b5 100644 --- a/src/XUngrDev.c +++ b/src/XUngrDev.c @@ -70,8 +70,11 @@ XUngrabDevice(dpy, dev, time) XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); + } GetReq(UngrabDevice, req); req->reqType = info->codes->major_opcode; diff --git a/src/XUngrDvB.c b/src/XUngrDvB.c index 77dbe77..cb318c6 100644 --- a/src/XUngrDvB.c +++ b/src/XUngrDvB.c @@ -73,10 +73,13 @@ XUngrabDeviceButton(dpy, dev, button, mo XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); - GetReq(UngrabDeviceButton, req); + } + GetReq(UngrabDeviceButton, req); req->reqType = info->codes->major_opcode; req->ReqType = X_UngrabDeviceButton; req->grabbed_device = dev->device_id; diff --git a/src/XUngrDvK.c b/src/XUngrDvK.c index 0ae3178..259d209 100644 --- a/src/XUngrDvK.c +++ b/src/XUngrDvK.c @@ -73,10 +73,13 @@ XUngrabDeviceKey(dpy, dev, key, modifier XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) { + UnlockDisplay(dpy); + SyncHandle(); return (NoSuchExtension); - GetReq(UngrabDeviceKey, req); + } + GetReq(UngrabDeviceKey, req); req->reqType = info->codes->major_opcode; req->ReqType = X_UngrabDeviceKey; req->grabbed_device = dev->device_id;