darwinXinput.c revision 6747b715
1/* 2 * X server support of the XINPUT extension for xquartz 3 * 4 * This is currently a copy of Xi/stubs.c, but eventually this 5 * should include more complete XINPUT support. 6 */ 7 8/************************************************************ 9 10Copyright 1989, 1998 The Open Group 11 12Permission to use, copy, modify, distribute, and sell this software and its 13documentation for any purpose is hereby granted without fee, provided that 14the above copyright notice appear in all copies and that both that 15copyright notice and this permission notice appear in supporting 16documentation. 17 18The above copyright notice and this permission notice shall be included in 19all copies or substantial portions of the Software. 20 21THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 25AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 26CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 28Except as contained in this notice, the name of The Open Group shall not be 29used in advertising or otherwise to promote the sale, use or other dealings 30in this Software without prior written authorization from The Open Group. 31 32Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. 33 34 All Rights Reserved 35 36Permission to use, copy, modify, and distribute this software and its 37documentation for any purpose and without fee is hereby granted, 38provided that the above copyright notice appear in all copies and that 39both that copyright notice and this permission notice appear in 40supporting documentation, and that the name of Hewlett-Packard not be 41used in advertising or publicity pertaining to distribution of the 42software without specific, written prior permission. 43 44HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 45ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 46HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 47ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 48WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 49ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 50SOFTWARE. 51 52********************************************************/ 53 54#ifdef HAVE_DIX_CONFIG_H 55#include <dix-config.h> 56#endif 57 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#include "darwin.h" 65 66/*********************************************************************** 67 * 68 * Caller: ProcXCloseDevice 69 * 70 * Take care of implementation-dependent details of closing a device. 71 * Some implementations may actually close the device, others may just 72 * remove this clients interest in that device. 73 * 74 * The default implementation is to do nothing (assume all input devices 75 * are initialized during X server initialization and kept open). 76 * 77 */ 78 79void 80CloseInputDevice(DeviceIntPtr d, ClientPtr client) 81{ 82 DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client); 83} 84 85/*********************************************************************** 86 * 87 * Caller: ProcXListInputDevices 88 * 89 * This is the implementation-dependent routine to initialize an input 90 * device to the point that information about it can be listed. 91 * Some implementations open all input devices when the server is first 92 * initialized, and never close them. Other implementations open only 93 * the X pointer and keyboard devices during server initialization, 94 * and only open other input devices when some client makes an 95 * XOpenDevice request. If some other process has the device open, the 96 * server may not be able to get information about the device to list it. 97 * 98 * This procedure should be used by implementations that do not initialize 99 * all input devices at server startup. It should do device-dependent 100 * initialization for any devices not previously initialized, and call 101 * AddInputDevice for each of those devices so that a DeviceIntRec will be 102 * created for them. 103 * 104 * The default implementation is to do nothing (assume all input devices 105 * are initialized during X server initialization and kept open). 106 * The commented-out sample code shows what you might do if you don't want 107 * the default. 108 * 109 */ 110 111void 112AddOtherInputDevices(void) 113{ 114 /********************************************************************** 115 for each uninitialized device, do something like: 116 117 DeviceIntPtr dev; 118 DeviceProc deviceProc; 119 pointer private; 120 121 dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE); 122 dev->public.devicePrivate = private; 123 RegisterOtherDevice(dev); 124 dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); 125 ************************************************************************/ 126 DEBUG_LOG("AddOtherInputDevices\n"); 127} 128 129/*********************************************************************** 130 * 131 * Caller: ProcXOpenDevice 132 * 133 * This is the implementation-dependent routine to open an input device. 134 * Some implementations open all input devices when the server is first 135 * initialized, and never close them. Other implementations open only 136 * the X pointer and keyboard devices during server initialization, 137 * and only open other input devices when some client makes an 138 * XOpenDevice request. This entry point is for the latter type of 139 * implementation. 140 * 141 * If the physical device is not already open, do it here. In this case, 142 * you need to keep track of the fact that one or more clients has the 143 * device open, and physically close it when the last client that has 144 * it open does an XCloseDevice. 145 * 146 * The default implementation is to do nothing (assume all input devices 147 * are opened during X server initialization and kept open). 148 * 149 */ 150 151void 152OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) 153{ 154 DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status); 155} 156 157/**************************************************************************** 158 * 159 * Caller: ProcXSetDeviceMode 160 * 161 * Change the mode of an extension device. 162 * This function is used to change the mode of a device from reporting 163 * relative motion to reporting absolute positional information, and 164 * vice versa. 165 * The default implementation below is that no such devices are supported. 166 * 167 */ 168 169int 170SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) 171{ 172 DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode); 173 return BadMatch; 174} 175 176/**************************************************************************** 177 * 178 * Caller: ProcXSetDeviceValuators 179 * 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. 185 * 186 */ 187 188int 189SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, 190 int *valuators, int first_valuator, int num_valuators) 191{ 192 DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client, 193 dev, valuators, first_valuator, num_valuators); 194 return BadMatch; 195} 196 197/**************************************************************************** 198 * 199 * Caller: ProcXChangeDeviceControl 200 * 201 * Change the specified device controls on an extension input device. 202 * 203 */ 204 205int 206ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, 207 xDeviceCtl * control) 208{ 209 210 DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control); 211 switch (control->control) { 212 case DEVICE_RESOLUTION: 213 return BadMatch; 214 case DEVICE_ABS_CALIB: 215 case DEVICE_ABS_AREA: 216 return BadMatch; 217 case DEVICE_CORE: 218 return BadMatch; 219 default: 220 return BadMatch; 221 } 222} 223 224 225/**************************************************************************** 226 * 227 * Caller: configAddDevice (and others) 228 * 229 * Add a new device with the specified options. 230 * 231 */ 232int 233NewInputDeviceRequest(InputOption *options, InputAttributes *attrs, 234 DeviceIntPtr *pdev) 235{ 236 DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev); 237 return BadValue; 238} 239 240/**************************************************************************** 241 * 242 * Caller: configRemoveDevice (and others) 243 * 244 * Remove the specified device previously added. 245 * 246 */ 247void 248DeleteInputDeviceRequest(DeviceIntPtr dev) 249{ 250 DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev); 251} 252 253void 254CloseInput (void) 255{ 256} 257 258