~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/darwin/darwinXinput.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: stubs.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
 
2
 
 
3
/*
 
4
 * X server support of the XINPUT extension for Darwin
 
5
 *
 
6
 * This is currently a copy of mi/stubs.c, but eventually this
 
7
 * should include more complete XINPUT support.
 
8
 */
 
9
 
 
10
/************************************************************
 
11
 
 
12
Copyright 1989, 1998  The Open Group
 
13
 
 
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
 
18
documentation.
 
19
 
 
20
The above copyright notice and this permission notice shall be included in
 
21
all copies or substantial portions of the Software.
 
22
 
 
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.
 
29
 
 
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.
 
33
 
 
34
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
 
35
 
 
36
                        All Rights Reserved
 
37
 
 
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.
 
45
 
 
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
 
52
SOFTWARE.
 
53
 
 
54
********************************************************/
 
55
/* $XFree86: xc/programs/Xserver/hw/darwin/darwinXinput.c,v 1.1 2004/05/28 07:44:00 torrey Exp $ */
 
56
 
 
57
#define  NEED_EVENTS
 
58
#include <X11/X.h>
 
59
#include <X11/Xproto.h>
 
60
#include "inputstr.h"
 
61
#include <X11/extensions/XI.h>
 
62
#include <X11/extensions/XIproto.h>
 
63
#include "XIstubs.h"
 
64
 
 
65
/***********************************************************************
 
66
 *
 
67
 * Caller:      ProcXChangeKeyboardDevice
 
68
 *
 
69
 * This procedure does the implementation-dependent portion of the work
 
70
 * needed to change the keyboard device.
 
71
 *
 
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.
 
75
 *
 
76
 * If you do not want clients to be able to focus the old X keyboard
 
77
 * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
 
78
 *
 
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 
 
81
 * a BadDevice error.
 
82
 *
 
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.
 
86
 *
 
87
 */
 
88
 
 
89
int
 
90
ChangeKeyboardDevice (old_dev, new_dev)
 
91
    DeviceIntPtr        old_dev;
 
92
    DeviceIntPtr        new_dev;
 
93
    {
 
94
    /***********************************************************************
 
95
     DeleteFocusClassDeviceStruct(old_dev);      * defined in xchgptr.c *
 
96
    **********************************************************************/
 
97
    return BadMatch;
 
98
    }
 
99
 
 
100
 
 
101
/***********************************************************************
 
102
 *
 
103
 * Caller:      ProcXChangePointerDevice
 
104
 *
 
105
 * This procedure does the implementation-dependent portion of the work
 
106
 * needed to change the pointer device.
 
107
 *
 
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.
 
111
 *
 
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.
 
115
 *
 
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.
 
120
 *
 
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 
 
123
 * BadDevice error.
 
124
 *
 
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.
 
128
 *
 
129
 */
 
130
 
 
131
int
 
132
ChangePointerDevice (
 
133
    DeviceIntPtr        old_dev,
 
134
    DeviceIntPtr        new_dev,
 
135
    unsigned char       x,
 
136
    unsigned char       y)
 
137
    {
 
138
    /***********************************************************************
 
139
    InitFocusClassDeviceStruct(old_dev);        * allow focusing old ptr*
 
140
 
 
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*
 
145
    else
 
146
        axes_changed = FALSE;
 
147
    *************************************************************************/
 
148
    return BadMatch;
 
149
    }
 
150
 
 
151
/***********************************************************************
 
152
 *
 
153
 * Caller:      ProcXCloseDevice
 
154
 *
 
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.
 
158
 *
 
159
 * The default implementation is to do nothing (assume all input devices
 
160
 * are initialized during X server initialization and kept open).
 
161
 *
 
162
 */
 
163
 
 
164
void
 
165
CloseInputDevice (d, client)
 
166
    DeviceIntPtr d;
 
167
    ClientPtr client;
 
168
    {
 
169
    }
 
170
 
 
171
/***********************************************************************
 
172
 *
 
173
 * Caller:      ProcXListInputDevices
 
174
 *
 
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.
 
183
 *
 
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 
 
188
 * created for them.
 
189
 *
 
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 
 
193
 * the default.
 
194
 *
 
195
 */
 
196
 
 
197
void
 
198
AddOtherInputDevices ()
 
199
    {
 
200
    /**********************************************************************
 
201
     for each uninitialized device, do something like: 
 
202
 
 
203
    DeviceIntPtr dev;
 
204
    DeviceProc deviceProc;
 
205
    pointer private;
 
206
 
 
207
    dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
 
208
    dev->public.devicePrivate = private;
 
209
    RegisterOtherDevice(dev);
 
210
    dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
 
211
    ************************************************************************/
 
212
 
 
213
    }
 
214
 
 
215
/***********************************************************************
 
216
 *
 
217
 * Caller:      ProcXOpenDevice
 
218
 *
 
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 
 
225
 * implementation.
 
226
 *
 
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.
 
231
 *
 
232
 * The default implementation is to do nothing (assume all input devices
 
233
 * are opened during X server initialization and kept open).
 
234
 *
 
235
 */
 
236
 
 
237
void
 
238
OpenInputDevice (dev, client, status)
 
239
    DeviceIntPtr dev;
 
240
    ClientPtr client;
 
241
    int *status;
 
242
    {
 
243
    }
 
244
 
 
245
/****************************************************************************
 
246
 *
 
247
 * Caller:      ProcXSetDeviceMode
 
248
 *
 
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
 
252
 * vice versa.
 
253
 * The default implementation below is that no such devices are supported.
 
254
 *
 
255
 */
 
256
 
 
257
int
 
258
SetDeviceMode (client, dev, mode)
 
259
    register    ClientPtr       client;
 
260
    DeviceIntPtr dev;
 
261
    int         mode;
 
262
    {
 
263
    return BadMatch;
 
264
    }
 
265
 
 
266
/****************************************************************************
 
267
 *
 
268
 * Caller:      ProcXSetDeviceValuators
 
269
 *
 
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.
 
275
 *
 
276
 */
 
277
 
 
278
int
 
279
SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
 
280
    register    ClientPtr       client;
 
281
    DeviceIntPtr dev;
 
282
    int         *valuators;
 
283
    int         first_valuator;
 
284
    int         num_valuators;
 
285
    {
 
286
    return BadMatch;
 
287
    }
 
288
 
 
289
/****************************************************************************
 
290
 *
 
291
 * Caller:      ProcXChangeDeviceControl
 
292
 *
 
293
 * Change the specified device controls on an extension input device.
 
294
 *
 
295
 */
 
296
 
 
297
int
 
298
ChangeDeviceControl (client, dev, control)
 
299
    register    ClientPtr       client;
 
300
    DeviceIntPtr dev;
 
301
    xDeviceCtl  *control;
 
302
    {
 
303
    switch (control->control)
 
304
        {
 
305
        case DEVICE_RESOLUTION:
 
306
            return (BadMatch);
 
307
        default:
 
308
            return (BadMatch);
 
309
        }
 
310
    }