--- libXi-X11R7.1-1.0.1/src/Makefile.am.hotplug~ 2006-03-20 20:54:58.000000000 +0100 +++ libXi-X11R7.1-1.0.1/src/Makefile.am 2006-05-23 19:36:03.000000000 +0200 @@ -3,6 +3,7 @@ lib_LTLIBRARIES = libXi.la libXi_la_SOURCES = \ + XAddDev.c \ XAllowDv.c \ XChgDCtl.c \ XChgFCtl.c \ @@ -29,6 +30,7 @@ XListDev.c \ XOpenDev.c \ XQueryDv.c \ + XRmDev.c \ XSelect.c \ XSetBMap.c \ XSetDVal.c \ --- libXi-X11R7.1-1.0.1/src/XAddDev.c.hotplug~ 2006-05-23 19:36:03.000000000 +0200 +++ libXi-X11R7.1-1.0.1/src/XAddDev.c 2006-05-23 19:36:03.000000000 +0200 @@ -0,0 +1,77 @@ +/* + * Copyright © 2004 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Kristian Høgsberg (krh@redhat.com) + */ + +#include +#include +#include +#include +#include +#include "XIint.h" + +int +_XiPutString(Display *dpy, _Xconst char *s) +{ + CARD16 length; + + length = strlen(s); + Data (dpy, (char *) &length, sizeof length); + Data (dpy, s, length); + + return 1 + ((length + 3) >> 2); +} + +int +XAddInputDevice(Display *dpy, _Xconst char *name, _Xconst char *driver, + XDeviceOption *options, int numOptions) +{ + xAddInputDeviceReq *req; + xAddInputDeviceReply rep; + CARD16 card16NumOptions; + int i; + XExtDisplayInfo *info = XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Add_XAddInputDevice) == -1) + return NoSuchExtension; + + GetReq(AddInputDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_AddInputDevice; + req->length += _XiPutString(dpy, name); + req->length += _XiPutString(dpy, driver); + + card16NumOptions = numOptions; + Data(dpy, (char *) &card16NumOptions, sizeof card16NumOptions); + req->length++; + + for (i = 0; i < numOptions; i++) { + req->length += _XiPutString(dpy, options[i].name); + req->length += _XiPutString(dpy, options[i].value); + } + + _XReply (dpy, (xReply *) &rep, 0, xFalse); + UnlockDisplay(dpy); + SyncHandle(); + + return rep.status; +} --- libXi-X11R7.1-1.0.1/src/XExtInt.c.hotplug~ 2006-03-31 16:50:24.000000000 +0200 +++ libXi-X11R7.1-1.0.1/src/XExtInt.c 2006-05-23 19:40:22.000000000 +0200 @@ -122,7 +122,9 @@ {XI_Present, XI_Add_XSetDeviceValuators_Major, XI_Add_XSetDeviceValuators_Minor}, {XI_Present, XI_Add_XChangeDeviceControl_Major, - XI_Add_XChangeDeviceControl_Minor} + XI_Add_XChangeDeviceControl_Minor}, + {XI_Present, XI_Add_XAddInputDevice_Major, + XI_Add_XAddInputDevice_Minor} }; /*********************************************************************** @@ -251,6 +253,14 @@ return (((y + (y >> 3)) & 030707070707) % 077); } +static int +_XiGetDevicePresenceNotifyEvent(Display *dpy) +{ + XExtDisplayInfo *info = XInput_find_display (dpy); + + return info->codes->first_event + XI_DevicePresenceNotify; +} + /*********************************************************************** * * Handle Input extension events. @@ -665,6 +675,19 @@ return (ENQUEUE_EVENT); } break; + case XI_DevicePresenceNotify: + { + XDevicePresenceNotifyEvent *ev = (XDevicePresenceNotifyEvent *) re; + devicePresenceNotify *ev2 = (devicePresenceNotify *) event; + + fprintf(stderr, "got DevicePresenceNotify event (reltype=%d)\n", reltype); + + *ev = *(XDevicePresenceNotifyEvent *) save; + ev->window = 0; + ev->time = ev2->time; + return (ENQUEUE_EVENT); + } + break; default: printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type); break; --- libXi-X11R7.1-1.0.1/src/XIint.h.hotplug~ 2006-03-31 16:50:24.000000000 +0200 +++ libXi-X11R7.1-1.0.1/src/XIint.h 2006-05-23 19:36:03.000000000 +0200 @@ -14,4 +14,6 @@ extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *); +extern int _XiPutString(Display *dpy, _Xconst char *s); + #endif --- libXi-X11R7.1-1.0.1/src/XRmDev.c.hotplug~ 2006-05-23 19:36:03.000000000 +0200 +++ libXi-X11R7.1-1.0.1/src/XRmDev.c 2006-05-23 19:36:03.000000000 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright © 2004 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Kristian Høgsberg (krh@redhat.com) + */ + +#include +#include +#include +#include +#include +#include "XIint.h" + + +int +XRemoveInputDevice(Display *dpy, _Xconst char *name) +{ + xRemoveInputDeviceReq *req; + xRemoveInputDeviceReply rep; + XExtDisplayInfo *info = XInput_find_display (dpy); + + LockDisplay (dpy); + if (_XiCheckExtInit(dpy, XInput_Add_XAddInputDevice) == -1) + return NoSuchExtension; + + GetReq(RemoveInputDevice,req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_RemoveInputDevice; + req->length += _XiPutString(dpy, name); + + _XReply (dpy, (xReply *) &rep, 0, xFalse); + UnlockDisplay(dpy); + SyncHandle(); + + return rep.status; +}