Commit c27e00ce authored by Jamey Sharp's avatar Jamey Sharp

Don't call XInput_find_display in _XiCheckExtInit, while the Display lock is held.

All callers of _XiCheckExtInit have already called XInput_find_display
first outside the lock, so just pass their copy of the XExtDisplayInfo
structure down. Besides being more correct, this should be slightly
faster. :-)

Thanks to Magnus Kessler <Magnus.Kessler@gmx.net> for identifying
the bug and proposing a workaround.
parent 5dda1e15
......@@ -71,7 +71,7 @@ XAllowDeviceEvents(dpy, dev, event_mode, time)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(AllowDeviceEvents, req);
......
......@@ -74,7 +74,7 @@ XChangeDeviceControl(dpy, dev, control, d)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1)
if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
return (NoSuchExtension);
GetReq(ChangeDeviceControl, req);
......
......@@ -73,7 +73,7 @@ XChangeFeedbackControl(dpy, dev, mask, f)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(ChangeFeedbackControl, req);
......
......@@ -74,7 +74,7 @@ XChangeDeviceKeyMapping(dpy, dev, first, syms_per_code, keysyms, count)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(ChangeDeviceKeyMapping, req);
......
......@@ -70,7 +70,7 @@ XChangeKeyboardDevice(dpy, dev)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(ChangeKeyboardDevice, req);
......
......@@ -72,7 +72,7 @@ XChangePointerDevice(dpy, dev, xaxis, yaxis)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(ChangePointerDevice, req);
......
......@@ -73,7 +73,7 @@ XChangeDeviceDontPropagateList(dpy, window, count, events, mode)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(ChangeDeviceDontPropagateList, req);
......
......@@ -69,7 +69,7 @@ XCloseDevice(dpy, dev)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(CloseDevice, req);
......
......@@ -71,7 +71,7 @@ XDeviceBell(dpy, dev, feedbackclass, feedbackid, percent)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell) == -1)
if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell, info) == -1)
return (NoSuchExtension);
GetReq(DeviceBell, req);
......
......@@ -191,12 +191,12 @@ _xidevicebusy(dpy, error)
*/
int
_XiCheckExtInit(dpy, version_index)
_XiCheckExtInit(dpy, version_index, info)
register Display *dpy;
register int version_index;
XExtDisplayInfo *info;
{
XExtensionVersion *ext;
XExtDisplayInfo *info = XInput_find_display(dpy);
XInputCheckExtension(dpy, info, -1);
......
......@@ -85,7 +85,7 @@ Time stop;
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDeviceTimeCoord *) NoSuchExtension);
GetReq(GetDeviceMotionEvents, req);
......
......@@ -81,7 +81,7 @@ XGetDeviceButtonMapping(dpy, device, map, nmap)
xGetDeviceButtonMappingReply rep;
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(GetDeviceButtonMapping, req);
......
......@@ -78,7 +78,7 @@ XGetDeviceControl(dpy, dev, control)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1)
if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
return ((XDeviceControl *) NoSuchExtension);
GetReq(GetDeviceControl, req);
......
......@@ -78,7 +78,7 @@ XGetFeedbackControl(dpy, dev, num_feedbacks)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XFeedbackState *) NoSuchExtension);
GetReq(GetFeedbackControl, req);
......
......@@ -76,7 +76,7 @@ XGetDeviceKeyMapping(register Display * dpy, XDevice * dev,
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((KeySym *) NoSuchExtension);
GetReq(GetDeviceKeyMapping, req);
......
......@@ -72,7 +72,7 @@ XGetDeviceModifierMapping(dpy, dev)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XModifierKeymap *) NoSuchExtension);
GetReq(GetDeviceModifierMapping, req);
......
......@@ -75,7 +75,7 @@ Window window;
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XEventClass *) NoSuchExtension);
GetReq(GetDeviceDontPropagateList, req);
......
......@@ -82,7 +82,7 @@ _XiGetExtensionVersion(register Display * dpy, _Xconst char *name, XExtDisplayIn
xGetExtensionVersionReply rep;
XExtensionVersion *ext;
if (_XiCheckExtInit(dpy, Dont_Check) == -1)
if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
return ((XExtensionVersion *) NoSuchExtension);
GetReq(GetExtensionVersion, req);
......
......@@ -80,7 +80,7 @@ XGrabDeviceButton(dpy, dev, button, modifiers, modifier_device,
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(GrabDeviceButton, req);
......
......@@ -80,7 +80,7 @@ XGrabDeviceKey(dpy, dev, key, modifiers, modifier_device,
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(GrabDeviceKey, req);
......
......@@ -78,7 +78,7 @@ XGrabDevice(dpy, dev, grab_window, ownerEvents, event_count, event_list,
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(GrabDevice, req);
......
......@@ -73,7 +73,7 @@ XGetDeviceFocus(dpy, dev, focus, revert_to, time)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(GetDeviceFocus, req);
......
......@@ -76,7 +76,7 @@ XGetSelectedExtensionEvents(dpy, w, this_client_count, this_client_list,
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(GetSelectedExtensionEvents, req);
......
......@@ -10,7 +10,7 @@
extern XExtDisplayInfo *XInput_find_display(Display *);
extern int _XiCheckExtInit(Display *, int);
extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *);
extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, XExtDisplayInfo *);
......
......@@ -82,7 +82,7 @@ XListInputDevices(dpy, ndevices)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDeviceInfo *) NULL);
GetReq(ListInputDevices, req);
......
......@@ -72,7 +72,7 @@ XOpenDevice(dpy, id)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDevice *) NoSuchExtension);
GetReq(OpenDevice, req);
......
......@@ -76,7 +76,7 @@ XQueryDeviceState(dpy, dev)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDeviceState *) NoSuchExtension);
GetReq(QueryDeviceState, req);
......
......@@ -71,7 +71,7 @@ XSelectExtensionEvent(dpy, w, event_list, count)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(SelectExtensionEvent, req);
......
......@@ -75,7 +75,7 @@ XSetDeviceButtonMapping(dpy, device, map, nmap)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(SetDeviceButtonMapping, req);
req->reqType = info->codes->major_opcode;
......
......@@ -74,7 +74,7 @@ XSetDeviceValuators(dpy, dev, valuators, first_valuator, num_valuators)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators) == -1)
if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators, info) == -1)
return (NoSuchExtension);
GetReq(SetDeviceValuators, req);
......
......@@ -72,7 +72,7 @@ XSetDeviceModifierMapping(dpy, dev, modmap)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReqExtra(SetDeviceModifierMapping, mapSize, req);
......
......@@ -71,7 +71,7 @@ XSetDeviceMode(dpy, dev, mode)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(SetDeviceMode, req);
......
......@@ -81,7 +81,7 @@ XSendExtensionEvent(dpy, dev, dest, prop, count, list, event)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
/* call through display to find proper conversion routine */
......
......@@ -70,7 +70,7 @@ XUngrabDevice(dpy, dev, time)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(UngrabDevice, req);
......
......@@ -73,7 +73,7 @@ XUngrabDeviceButton(dpy, dev, button, modifiers, modifier_dev, grab_window)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(UngrabDeviceButton, req);
......
......@@ -73,7 +73,7 @@ XUngrabDeviceKey(dpy, dev, key, modifiers, modifier_dev, grab_window)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return (NoSuchExtension);
GetReq(UngrabDeviceKey, req);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment