First import
[xorg_rtime.git] / xorg-server-1.4 / Xi / stubs.c
blob40cd02fe1ef8775b4e80c7c00102e421f6b49e12
1 /************************************************************
3 Copyright 1989, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
25 Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
27 All Rights Reserved
29 Permission to use, copy, modify, and distribute this software and its
30 documentation for any purpose and without fee is hereby granted,
31 provided that the above copyright notice appear in all copies and that
32 both that copyright notice and this permission notice appear in
33 supporting documentation, and that the name of Hewlett-Packard not be
34 used in advertising or publicity pertaining to distribution of the
35 software without specific, written prior permission.
37 HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39 HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43 SOFTWARE.
45 ********************************************************/
48 * stubs.c -- stub routines for the X server side of the XINPUT
49 * extension. This file is mainly to be used only as documentation.
50 * There is not much code here, and you can't get a working XINPUT
51 * server just using this.
52 * The Xvfb server uses this file so it will compile with the same
53 * object files as the real X server for a platform that has XINPUT.
54 * Xnest could do the same thing.
57 #define NEED_EVENTS
58 #ifdef HAVE_DIX_CONFIG_H
59 #include <dix-config.h>
60 #endif
62 #include <X11/X.h>
63 #include <X11/Xproto.h>
64 #include "inputstr.h"
65 #include <X11/extensions/XI.h>
66 #include <X11/extensions/XIproto.h>
67 #include "XIstubs.h"
69 /***********************************************************************
71 * Caller: ProcXCloseDevice
73 * Take care of implementation-dependent details of closing a device.
74 * Some implementations may actually close the device, others may just
75 * remove this clients interest in that device.
77 * The default implementation is to do nothing (assume all input devices
78 * are initialized during X server initialization and kept open).
82 void
83 CloseInputDevice(DeviceIntPtr d, ClientPtr client)
87 /***********************************************************************
89 * Caller: ProcXListInputDevices
91 * This is the implementation-dependent routine to initialize an input
92 * device to the point that information about it can be listed.
93 * Some implementations open all input devices when the server is first
94 * initialized, and never close them. Other implementations open only
95 * the X pointer and keyboard devices during server initialization,
96 * and only open other input devices when some client makes an
97 * XOpenDevice request. If some other process has the device open, the
98 * server may not be able to get information about the device to list it.
100 * This procedure should be used by implementations that do not initialize
101 * all input devices at server startup. It should do device-dependent
102 * initialization for any devices not previously initialized, and call
103 * AddInputDevice for each of those devices so that a DeviceIntRec will be
104 * created for them.
106 * The default implementation is to do nothing (assume all input devices
107 * are initialized during X server initialization and kept open).
108 * The commented-out sample code shows what you might do if you don't want
109 * the default.
113 void
114 AddOtherInputDevices(void)
116 /**********************************************************************
117 for each uninitialized device, do something like:
119 DeviceIntPtr dev;
120 DeviceProc deviceProc;
121 pointer private;
123 dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
124 dev->public.devicePrivate = private;
125 RegisterOtherDevice(dev);
126 dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
127 ************************************************************************/
131 /***********************************************************************
133 * Caller: ProcXOpenDevice
135 * This is the implementation-dependent routine to open an input device.
136 * Some implementations open all input devices when the server is first
137 * initialized, and never close them. Other implementations open only
138 * the X pointer and keyboard devices during server initialization,
139 * and only open other input devices when some client makes an
140 * XOpenDevice request. This entry point is for the latter type of
141 * implementation.
143 * If the physical device is not already open, do it here. In this case,
144 * you need to keep track of the fact that one or more clients has the
145 * device open, and physically close it when the last client that has
146 * it open does an XCloseDevice.
148 * The default implementation is to do nothing (assume all input devices
149 * are opened during X server initialization and kept open).
153 void
154 OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
158 /****************************************************************************
160 * Caller: ProcXSetDeviceMode
162 * Change the mode of an extension device.
163 * This function is used to change the mode of a device from reporting
164 * relative motion to reporting absolute positional information, and
165 * vice versa.
166 * The default implementation below is that no such devices are supported.
171 SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
173 return BadMatch;
176 /****************************************************************************
178 * Caller: ProcXSetDeviceValuators
180 * Set the value of valuators on an extension input device.
181 * This function is used to set the initial value of valuators on
182 * those input devices that are capable of reporting either relative
183 * motion or an absolute position, and allow an initial position to be set.
184 * The default implementation below is that no such devices are supported.
189 SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
190 int *valuators, int first_valuator, int num_valuators)
192 return BadMatch;
195 /****************************************************************************
197 * Caller: ProcXChangeDeviceControl
199 * Change the specified device controls on an extension input device.
204 ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
205 xDeviceCtl * control)
207 switch (control->control) {
208 case DEVICE_RESOLUTION:
209 return (BadMatch);
210 case DEVICE_ABS_CALIB:
211 case DEVICE_ABS_AREA:
212 return (BadMatch);
213 case DEVICE_CORE:
214 return (BadMatch);
215 default:
216 return (BadMatch);
221 /****************************************************************************
223 * Caller: configAddDevice (and others)
225 * Add a new device with the specified options.
229 NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
231 return BadValue;
234 /****************************************************************************
236 * Caller: configRemoveDevice (and others)
238 * Remove the specified device previously added.
241 void
242 DeleteInputDeviceRequest(DeviceIntPtr dev)