diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c index 289bd85af..8134b4060 100644 --- a/Xi/chgkbd.c +++ b/Xi/chgkbd.c @@ -64,7 +64,6 @@ SOFTWARE. #include "XIstubs.h" #include "globals.h" #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -99,107 +98,10 @@ SProcXChangeKeyboardDevice(register ClientPtr client) int ProcXChangeKeyboardDevice(register ClientPtr client) { - int i; - DeviceIntPtr xkbd = inputInfo.keyboard; - DeviceIntPtr dev; - FocusClassPtr xf = xkbd->focus; - FocusClassPtr df; - KeyClassPtr k; - xChangeKeyboardDeviceReply rep; - changeDeviceNotify ev; - REQUEST(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); - rep.repType = X_Reply; - rep.RepType = X_ChangeKeyboardDevice; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - rep.status = -1; - SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, - BadDevice); - return Success; - } - - k = dev->key; - if (k == NULL) { - rep.status = -1; - SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, - BadMatch); - return Success; - } - - if (((dev->grab) && !SameClient(dev->grab, client)) || - ((xkbd->grab) && !SameClient(xkbd->grab, client))) - rep.status = AlreadyGrabbed; - else if ((dev->sync.frozen && - dev->sync.other && !SameClient(dev->sync.other, client)) || - (xkbd->sync.frozen && - xkbd->sync.other && !SameClient(xkbd->sync.other, client))) - rep.status = GrabFrozen; - else { - if (ChangeKeyboardDevice(xkbd, dev) != Success) { - SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, - BadDevice); - return Success; - } - if (!dev->focus) - InitFocusClassDeviceStruct(dev); - if (!dev->kbdfeed) - InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA, - (KbdCtrlProcPtr) NoopDDA); - df = dev->focus; - df->win = xf->win; - df->revert = xf->revert; - df->time = xf->time; - df->traceGood = xf->traceGood; - if (df->traceSize != xf->traceSize) { - Must_have_memory = TRUE; /* XXX */ - df->trace = (WindowPtr *) xrealloc(df->trace, - xf->traceSize * - sizeof(WindowPtr)); - Must_have_memory = FALSE; /* XXX */ - } - df->traceSize = xf->traceSize; - for (i = 0; i < df->traceSize; i++) - df->trace[i] = xf->trace[i]; - RegisterOtherDevice(xkbd); - RegisterKeyboardDevice(dev); - - ev.type = ChangeDeviceNotify; - ev.deviceid = stuff->deviceid; - ev.time = currentTime.milliseconds; - ev.request = NewKeyboard; - - SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1); - SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode, - k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + - 1, client); - - rep.status = 0; - } - - WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep); + SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, + BadDevice); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XChangeKeyboardDevice - * function, if the client and server have a different byte ordering. - * - */ - -void -SRepXChangeKeyboardDevice(ClientPtr client, int size, - xChangeKeyboardDeviceReply * rep) -{ - register char n; - - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, n); - WriteToClient(client, size, (char *)rep); -} diff --git a/Xi/chgkbd.h b/Xi/chgkbd.h index 7a883b7f0..5f9922336 100644 --- a/Xi/chgkbd.h +++ b/Xi/chgkbd.h @@ -36,9 +36,4 @@ int SProcXChangeKeyboardDevice(ClientPtr /* client */ int ProcXChangeKeyboardDevice(ClientPtr /* client */ ); -void SRepXChangeKeyboardDevice(ClientPtr /* client */ , - int /* size */ , - xChangeKeyboardDeviceReply * /* rep */ - ); - #endif /* CHGKBD_H */ diff --git a/Xi/chgptr.c b/Xi/chgptr.c index b79909216..22c8a5f5e 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -101,97 +101,10 @@ SProcXChangePointerDevice(register ClientPtr client) int ProcXChangePointerDevice(register ClientPtr client) { - DeviceIntPtr xptr = inputInfo.pointer; - DeviceIntPtr dev; - ValuatorClassPtr v; - xChangePointerDeviceReply rep; - changeDeviceNotify ev; - REQUEST(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq); - rep.repType = X_Reply; - rep.RepType = X_ChangePointerDevice; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - rep.status = -1; - SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, - BadDevice); - return Success; - } - - v = dev->valuator; - if (v == NULL || v->numAxes < 2 || - stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) { - rep.status = -1; - SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch); - return Success; - } - - if (((dev->grab) && !SameClient(dev->grab, client)) || - ((xptr->grab) && !SameClient(xptr->grab, client))) - rep.status = AlreadyGrabbed; - else if ((dev->sync.frozen && - dev->sync.other && !SameClient(dev->sync.other, client)) || - (xptr->sync.frozen && - xptr->sync.other && !SameClient(xptr->sync.other, client))) - rep.status = GrabFrozen; - else { - if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) != - Success) { - SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, - BadDevice); - return Success; - } - if (dev->focus) - DeleteFocusClassDeviceStruct(dev); - if (!dev->button) - InitButtonClassDeviceStruct(dev, 0, NULL); - if (!dev->ptrfeed) - InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA); - RegisterOtherDevice(xptr); - RegisterPointerDevice(dev); - - ev.type = ChangeDeviceNotify; - ev.deviceid = stuff->deviceid; - ev.time = currentTime.milliseconds; - ev.request = NewPointer; - - SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1); - SendMappingNotify(MappingPointer, 0, 0, client); - - rep.status = 0; - } - - WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep); + SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, + BadDevice); return Success; } - -void -DeleteFocusClassDeviceStruct(DeviceIntPtr dev) -{ - xfree(dev->focus->trace); - xfree(dev->focus); - dev->focus = NULL; -} - -/*********************************************************************** - * - * This procedure writes the reply for the XChangePointerDevice - * function, if the client and server have a different byte ordering. - * - */ - -void -SRepXChangePointerDevice(ClientPtr client, int size, - xChangePointerDeviceReply * rep) -{ - register char n; - - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, n); - WriteToClient(client, size, (char *)rep); -} diff --git a/Xi/chgptr.h b/Xi/chgptr.h index aeda822aa..fb3b5cc39 100644 --- a/Xi/chgptr.h +++ b/Xi/chgptr.h @@ -53,9 +53,4 @@ void FindInterestedChildren( /* FIXME: could be static? */ int /* count */ ); -void SRepXChangePointerDevice(ClientPtr /* client */ , - int /* size */ , - xChangePointerDeviceReply * /* rep */ - ); - #endif /* CHGPTR_H */ diff --git a/Xi/extinit.c b/Xi/extinit.c index c35a96416..454883762 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -465,12 +465,6 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) else if (rep->RepType == X_GetDeviceMotionEvents) SRepXGetDeviceMotionEvents(client, len, (xGetDeviceMotionEventsReply *) rep); - else if (rep->RepType == X_ChangeKeyboardDevice) - SRepXChangeKeyboardDevice(client, len, - (xChangeKeyboardDeviceReply *) rep); - else if (rep->RepType == X_ChangePointerDevice) - SRepXChangePointerDevice(client, len, - (xChangePointerDeviceReply *) rep); else if (rep->RepType == X_GrabDevice) SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); else if (rep->RepType == X_GetDeviceFocus) diff --git a/Xi/stubs.c b/Xi/stubs.c index 28ecd8bd2..e2ed1ceff 100644 --- a/Xi/stubs.c +++ b/Xi/stubs.c @@ -66,86 +66,6 @@ SOFTWARE. #include #include "XIstubs.h" -/*********************************************************************** - * - * Caller: ProcXChangeKeyboardDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the keyboard device. - * - * The X keyboard device has a FocusRec. If the device that has been - * made into the new X keyboard did not have a FocusRec, - * ProcXChangeKeyboardDevice will allocate one for it. - * - * If you do not want clients to be able to focus the old X keyboard - * device, call DeleteFocusClassDeviceStruct to free the FocusRec. - * - * If you support input devices with keys that you do not want to be - * used as the X keyboard, you need to check for them here and return - * a BadDevice error. - * - * The default implementation is to do nothing (assume you do want - * clients to be able to focus the old X keyboard). The commented-out - * sample code shows what you might do if you don't want the default. - * - */ - -int -ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev) -{ - /*********************************************************************** - DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * - **********************************************************************/ - return BadMatch; -} - -/*********************************************************************** - * - * Caller: ProcXChangePointerDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the pointer device. - * - * The X pointer device does not have a FocusRec. If the device that - * has been made into the new X pointer had a FocusRec, - * ProcXChangePointerDevice will free it. - * - * If you want clients to be able to focus the old pointer device that - * has now become accessible through the input extension, you need to - * add a FocusRec to it here. - * - * The XChangePointerDevice protocol request also allows the client - * to choose which axes of the new pointer device are used to move - * the X cursor in the X- and Y- directions. If the axes are different - * than the default ones, you need to keep track of that here. - * - * If you support input devices with valuators that you do not want to be - * used as the X pointer, you need to check for them here and return a - * BadDevice error. - * - * The default implementation is to do nothing (assume you don't want - * clients to be able to focus the old X pointer). The commented-out - * sample code shows what you might do if you don't want the default. - * - */ - -int -ChangePointerDevice(DeviceIntPtr old_dev, - DeviceIntPtr new_dev, unsigned char x, unsigned char y) -{ - /*********************************************************************** - InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* - - x_axis = x; * keep track of new x-axis* - y_axis = y; * keep track of new y-axis* - if (x_axis != 0 || y_axis != 1) - axes_changed = TRUE; * remember axes have changed* - else - axes_changed = FALSE; - *************************************************************************/ - return BadMatch; -} - /*********************************************************************** * * Caller: ProcXCloseDevice diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 915a21917..be3368dff 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -251,148 +251,12 @@ OpenInputDevice(DeviceIntPtr dev, *status = Success; } - -/*********************************************************************** - * - * Caller: ProcXChangeKeyboardDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the keyboard device. - * - * The X keyboard device has a FocusRec. If the device that has been - * made into the new X keyboard did not have a FocusRec, - * ProcXChangeKeyboardDevice will allocate one for it. - * - * If you do not want clients to be able to focus the old X keyboard - * device, call DeleteFocusClassDeviceStruct to free the FocusRec. - * - * If you support input devices with keys that you do not want to be - * used as the X keyboard, you need to check for them here and return - * a BadDevice error. - * - * The default implementation is to do nothing (assume you do want - * clients to be able to focus the old X keyboard). The commented-out - * sample code shows what you might do if you don't want the default. - * - *********************************************************************** - */ - -int -ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) -{ - /********************************************************************** - * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * - **********************************************************************/ - return !Success; -} - - -/*********************************************************************** - * - * Caller: ProcXChangePointerDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the pointer device. - * - * The X pointer device does not have a FocusRec. If the device that - * has been made into the new X pointer had a FocusRec, - * ProcXChangePointerDevice will free it. - * - * If you want clients to be able to focus the old pointer device that - * has now become accessible through the input extension, you need to - * add a FocusRec to it here. - * - * The XChangePointerDevice protocol request also allows the client - * to choose which axes of the new pointer device are used to move - * the X cursor in the X- and Y- directions. If the axes are different - * than the default ones, you need to keep track of that here. - * - * If you support input devices with valuators that you do not want to be - * used as the X pointer, you need to check for them here and return a - * BadDevice error. - * - * The default implementation is to do nothing (assume you don't want - * clients to be able to focus the old X pointer). The commented-out - * sample code shows what you might do if you don't want the default. - * - *********************************************************************** - */ - -int -ChangePointerDevice ( - DeviceIntPtr old_dev, - DeviceIntPtr new_dev, - unsigned char x, - unsigned char y) -{ - /************************************************************************ - InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* - - x_axis = x; * keep track of new x-axis* - y_axis = y; * keep track of new y-axis* - if (x_axis != 0 || y_axis != 1) - axes_changed = TRUE; * remember axes have changed* - else - axes_changed = FALSE; - *************************************************************************/ - - return !Success; -} - - -/*********************************************************************** - * - * Caller: ProcXCloseDevice - * - * Take care of implementation-dependent details of closing a device. - * Some implementations may actually close the device, others may just - * remove this clients interest in that device. - * - * The default implementation is to do nothing (assume all input devices - * are initialized during X server initialization and kept open). - * - *********************************************************************** - */ - void -CloseInputDevice (DeviceIntPtr d, ClientPtr client) +CloseInputDevice(DeviceIntPtr dev, + ClientPtr client) { } - -/*********************************************************************** - * - * Caller: ProcXListInputDevices - * - * This is the implementation-dependent routine to initialize an input - * device to the point that information about it can be listed. - * Some implementations open all input devices when the server is first - * initialized, and never close them. Other implementations open only - * the X pointer and keyboard devices during server initialization, - * and only open other input devices when some client makes an - * XOpenDevice request. If some other process has the device open, the - * server may not be able to get information about the device to list it. - * - * This procedure should be used by implementations that do not initialize - * all input devices at server startup. It should do device-dependent - * initialization for any devices not previously initialized, and call - * AddInputDevice for each of those devices so that a DeviceIntRec will be - * created for them. - * - * The default implementation is to do nothing (assume all input devices - * are initialized during X server initialization and kept open). - * The commented-out sample code shows what you might do if you don't want - * the default. - * - *********************************************************************** - */ - -void -AddOtherInputDevices () -{ -} - - /**************************************************************************** * * Caller: ProcXSetDeviceMode @@ -475,6 +339,11 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control) return (*local->control_proc)(local, control); } } + +void +AddOtherInputDevices() +{ +} #endif int diff --git a/include/XIstubs.h b/include/XIstubs.h index 45f6eb10c..6797e0732 100644 --- a/include/XIstubs.h +++ b/include/XIstubs.h @@ -26,18 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef XI_STUBS_H #define XI_STUBS_H 1 -int -ChangeKeyboardDevice ( - DeviceIntPtr /* old_dev */, - DeviceIntPtr /* new_dev */); - -int -ChangePointerDevice ( - DeviceIntPtr /* old_dev */, - DeviceIntPtr /* new_dev */, - unsigned char /* x */, - unsigned char /* y */); - void CloseInputDevice ( DeviceIntPtr /* d */,