1
/* $Xorg: stubs.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
4
* X server support of the XINPUT extension for Darwin
6
* This is currently a copy of mi/stubs.c, but eventually this
7
* should include more complete XINPUT support.
10
/************************************************************
12
Copyright 1989, 1998 The Open Group
14
Permission to use, copy, modify, distribute, and sell this software and its
15
documentation for any purpose is hereby granted without fee, provided that
16
the above copyright notice appear in all copies and that both that
17
copyright notice and this permission notice appear in supporting
20
The above copyright notice and this permission notice shall be included in
21
all copies or substantial portions of the Software.
23
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
27
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
Except as contained in this notice, the name of The Open Group shall not be
31
used in advertising or otherwise to promote the sale, use or other dealings
32
in this Software without prior written authorization from The Open Group.
34
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
38
Permission to use, copy, modify, and distribute this software and its
39
documentation for any purpose and without fee is hereby granted,
40
provided that the above copyright notice appear in all copies and that
41
both that copyright notice and this permission notice appear in
42
supporting documentation, and that the name of Hewlett-Packard not be
43
used in advertising or publicity pertaining to distribution of the
44
software without specific, written prior permission.
46
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
47
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
48
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
49
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
50
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
51
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
54
********************************************************/
55
/* $XFree86: xc/programs/Xserver/hw/darwin/darwinXinput.c,v 1.1 2004/05/28 07:44:00 torrey Exp $ */
59
#include <X11/Xproto.h>
61
#include <X11/extensions/XI.h>
62
#include <X11/extensions/XIproto.h>
65
/***********************************************************************
67
* Caller: ProcXChangeKeyboardDevice
69
* This procedure does the implementation-dependent portion of the work
70
* needed to change the keyboard device.
72
* The X keyboard device has a FocusRec. If the device that has been
73
* made into the new X keyboard did not have a FocusRec,
74
* ProcXChangeKeyboardDevice will allocate one for it.
76
* If you do not want clients to be able to focus the old X keyboard
77
* device, call DeleteFocusClassDeviceStruct to free the FocusRec.
79
* If you support input devices with keys that you do not want to be
80
* used as the X keyboard, you need to check for them here and return
83
* The default implementation is to do nothing (assume you do want
84
* clients to be able to focus the old X keyboard). The commented-out
85
* sample code shows what you might do if you don't want the default.
90
ChangeKeyboardDevice (old_dev, new_dev)
94
/***********************************************************************
95
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
96
**********************************************************************/
101
/***********************************************************************
103
* Caller: ProcXChangePointerDevice
105
* This procedure does the implementation-dependent portion of the work
106
* needed to change the pointer device.
108
* The X pointer device does not have a FocusRec. If the device that
109
* has been made into the new X pointer had a FocusRec,
110
* ProcXChangePointerDevice will free it.
112
* If you want clients to be able to focus the old pointer device that
113
* has now become accessible through the input extension, you need to
114
* add a FocusRec to it here.
116
* The XChangePointerDevice protocol request also allows the client
117
* to choose which axes of the new pointer device are used to move
118
* the X cursor in the X- and Y- directions. If the axes are different
119
* than the default ones, you need to keep track of that here.
121
* If you support input devices with valuators that you do not want to be
122
* used as the X pointer, you need to check for them here and return a
125
* The default implementation is to do nothing (assume you don't want
126
* clients to be able to focus the old X pointer). The commented-out
127
* sample code shows what you might do if you don't want the default.
132
ChangePointerDevice (
133
DeviceIntPtr old_dev,
134
DeviceIntPtr new_dev,
138
/***********************************************************************
139
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
141
x_axis = x; * keep track of new x-axis*
142
y_axis = y; * keep track of new y-axis*
143
if (x_axis != 0 || y_axis != 1)
144
axes_changed = TRUE; * remember axes have changed*
146
axes_changed = FALSE;
147
*************************************************************************/
151
/***********************************************************************
153
* Caller: ProcXCloseDevice
155
* Take care of implementation-dependent details of closing a device.
156
* Some implementations may actually close the device, others may just
157
* remove this clients interest in that device.
159
* The default implementation is to do nothing (assume all input devices
160
* are initialized during X server initialization and kept open).
165
CloseInputDevice (d, client)
171
/***********************************************************************
173
* Caller: ProcXListInputDevices
175
* This is the implementation-dependent routine to initialize an input
176
* device to the point that information about it can be listed.
177
* Some implementations open all input devices when the server is first
178
* initialized, and never close them. Other implementations open only
179
* the X pointer and keyboard devices during server initialization,
180
* and only open other input devices when some client makes an
181
* XOpenDevice request. If some other process has the device open, the
182
* server may not be able to get information about the device to list it.
184
* This procedure should be used by implementations that do not initialize
185
* all input devices at server startup. It should do device-dependent
186
* initialization for any devices not previously initialized, and call
187
* AddInputDevice for each of those devices so that a DeviceIntRec will be
190
* The default implementation is to do nothing (assume all input devices
191
* are initialized during X server initialization and kept open).
192
* The commented-out sample code shows what you might do if you don't want
198
AddOtherInputDevices ()
200
/**********************************************************************
201
for each uninitialized device, do something like:
204
DeviceProc deviceProc;
207
dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
208
dev->public.devicePrivate = private;
209
RegisterOtherDevice(dev);
210
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
211
************************************************************************/
215
/***********************************************************************
217
* Caller: ProcXOpenDevice
219
* This is the implementation-dependent routine to open an input device.
220
* Some implementations open all input devices when the server is first
221
* initialized, and never close them. Other implementations open only
222
* the X pointer and keyboard devices during server initialization,
223
* and only open other input devices when some client makes an
224
* XOpenDevice request. This entry point is for the latter type of
227
* If the physical device is not already open, do it here. In this case,
228
* you need to keep track of the fact that one or more clients has the
229
* device open, and physically close it when the last client that has
230
* it open does an XCloseDevice.
232
* The default implementation is to do nothing (assume all input devices
233
* are opened during X server initialization and kept open).
238
OpenInputDevice (dev, client, status)
245
/****************************************************************************
247
* Caller: ProcXSetDeviceMode
249
* Change the mode of an extension device.
250
* This function is used to change the mode of a device from reporting
251
* relative motion to reporting absolute positional information, and
253
* The default implementation below is that no such devices are supported.
258
SetDeviceMode (client, dev, mode)
259
register ClientPtr client;
266
/****************************************************************************
268
* Caller: ProcXSetDeviceValuators
270
* Set the value of valuators on an extension input device.
271
* This function is used to set the initial value of valuators on
272
* those input devices that are capable of reporting either relative
273
* motion or an absolute position, and allow an initial position to be set.
274
* The default implementation below is that no such devices are supported.
279
SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
280
register ClientPtr client;
289
/****************************************************************************
291
* Caller: ProcXChangeDeviceControl
293
* Change the specified device controls on an extension input device.
298
ChangeDeviceControl (client, dev, control)
299
register ClientPtr client;
303
switch (control->control)
305
case DEVICE_RESOLUTION: