xf86OSmouse.h revision 45e9809aff7304721fddb95654901b32195c9c7a
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining a
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copy of this software and associated documentation files (the "Software"),
45e9809aff7304721fddb95654901b32195c9c7avboxsync * to deal in the Software without restriction, including without limitation
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and/or sell copies of the Software, and to permit persons to whom the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Software is furnished to do so, subject to the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice and this permission notice shall be included in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * all copies or substantial portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OTHER DEALINGS IN THE SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Except as contained in this notice, the name of the copyright holder(s)
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and author(s) shall not be used in advertising or otherwise to promote
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the sale, use or other dealings in this Software without prior written
45e9809aff7304721fddb95654901b32195c9c7avboxsync * authorization from the copyright holder(s) and author(s).
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Public interface to OS-specific mouse support. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Mouse interface classes */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define MSE_MISC 0x20 /* The OS layer will identify the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * specific protocol names that are
45e9809aff7304721fddb95654901b32195c9c7avboxsync * supported for this class. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Mouse Protocol IDs. */
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef enum {
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef int (*GetInterfaceTypesProc)(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef const char **(*BuiltinNamesProc)(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef Bool (*CheckProtocolProc)(const char *protocol);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef Bool (*BuiltinPreInitProc)(InputInfoPtr pInfo, const char *protocol,
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef const char *(*DefaultProtocolProc)(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate,
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef const char *(*FindDeviceProc)(InputInfoPtr pInfo, const char *protocol,
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef const char *(*GuessProtocolProc)(InputInfoPtr pInfo, int flags);
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OSMouseInfoRec is used to pass information from the OSMouse layer to the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OS-independent mouse driver.
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct {
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SupportedInterfaces: Returns the mouse interface types that the OS support.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * If MSE_MISC is returned, then the BuiltinNames and
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CheckProtocol should be set.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * BuiltinNames: Returns the names of the protocols that are fully handled
45e9809aff7304721fddb95654901b32195c9c7avboxsync * in the OS-specific code. These are names that don't appear
45e9809aff7304721fddb95654901b32195c9c7avboxsync * directly in the main "mouse" driver.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CheckProtocol: Checks if the protocol name given is supported by the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OS. It should return TRUE for both "builtin" protocols and
45e9809aff7304721fddb95654901b32195c9c7avboxsync * protocols of type MSE_MISC that are supported by the OS.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * PreInit: The PreInit function for protocols that are builtin. This
45e9809aff7304721fddb95654901b32195c9c7avboxsync * function is passed the protocol name.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DefaultProtocol: Returns the name of a default protocol that should be used
45e9809aff7304721fddb95654901b32195c9c7avboxsync * for the OS when none has been supplied in the config file.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This should only be set when there is a reasonable default.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SetupAuto: This function can be used to do OS-specific protocol
45e9809aff7304721fddb95654901b32195c9c7avboxsync * auto-detection. It returns the name of the detected protocol,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * or NULL when detection fails. It may also adjust one or more
45e9809aff7304721fddb95654901b32195c9c7avboxsync * of the "protoPara" values for the detected protocol by setting
45e9809aff7304721fddb95654901b32195c9c7avboxsync * then to something other than -1. SetupAuto gets called in two
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ways. The first is before any devices have been opened. This
45e9809aff7304721fddb95654901b32195c9c7avboxsync * can be used when the protocol "Auto" always maps to a single
45e9809aff7304721fddb95654901b32195c9c7avboxsync * protocol type. The second is with the device open, allowing
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OS-specific probing to be done.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2
45e9809aff7304721fddb95654901b32195c9c7avboxsync * protocol types.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SetBMRes: Set the resolution and sample rate for MSE_BM protocol types.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * FindDevice: This function gets called when no Device has been specified
45e9809aff7304721fddb95654901b32195c9c7avboxsync * in the config file. OS-specific methods may be used to guess
45e9809aff7304721fddb95654901b32195c9c7avboxsync * which input device to use. This function is called after the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * pre-open attempts at protocol discovery are done, but before
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the device is open. I.e., after the first SetupAuto() call,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * after the DefaultProtocol() call, but before the PreInit()
45e9809aff7304721fddb95654901b32195c9c7avboxsync * call. Available protocol information may be used in locating
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the default input device.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * GuessProtocol: A last resort attempt at guessing the mouse protocol by
45e9809aff7304721fddb95654901b32195c9c7avboxsync * whatever OS-specific means might be available. OS-independent
45e9809aff7304721fddb95654901b32195c9c7avboxsync * things should be in the mouse driver. This function gets
45e9809aff7304721fddb95654901b32195c9c7avboxsync * called after the mouse driver's OS-independent methods have
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Adjust this when the mouse interface changes. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync * 1.0.0 - Everything up to when versioning was started.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * 1.1.0 - FindDevice and GuessProtocol added to OSMouseInfoRec
45e9809aff7304721fddb95654901b32195c9c7avboxsync * 1.2.0 - xisbscale added to MouseDevRec
45e9809aff7304721fddb95654901b32195c9c7avboxsync BUILTIN_INTERFACE_VERSION_NUMERIC(OS_MOUSE_VERSION_MAJOR, \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Z axis mapping */
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Generalize for other axes. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Mouse device record. This is shared by the mouse driver and the OSMouse
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (*checkMovementsProc)(InputInfoPtr,int, int);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef Bool (*dataGoodProc)(struct _MouseDevRec *);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons,
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (*MouseCommonOptProc)(InputInfoPtr pInfo);
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _MouseDevRec {
45e9809aff7304721fddb95654901b32195c9c7avboxsync const char * mseDevice;
45e9809aff7304721fddb95654901b32195c9c7avboxsync const char * protocol;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int emulateState; /* automata state for 2 button mode */
45e9809aff7304721fddb95654901b32195c9c7avboxsync int emulate3Timeout;/* Timeout for 3 button emulation */
45e9809aff7304721fddb95654901b32195c9c7avboxsync * mouse dev */
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Arg to maintain before
45e9809aff7304721fddb95654901b32195c9c7avboxsync * emulate3buttons timer callback */
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned char inSync; /* driver in sync with datastream */
45e9809aff7304721fddb95654901b32195c9c7avboxsync const char * origProtocol;
45e9809aff7304721fddb95654901b32195c9c7avboxsync CARD32 emulate3Expires;/* time to fire emulation code */
45e9809aff7304721fddb95654901b32195c9c7avboxsync int negativeX; /* Button values. Unlike the Z and */
45e9809aff7304721fddb95654901b32195c9c7avboxsync int positiveX; /* W equivalents, these are button */
45e9809aff7304721fddb95654901b32195c9c7avboxsync int negativeY; /* values rather than button masks. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync int wheelButtonTimeout;/* Timeout for the wheel button emulation */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* _XF86OSMOUSE_H_ */