1706f2543Smrg/* 2706f2543Smrg * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org> 3706f2543Smrg * 4706f2543Smrg * Permission to use, copy, modify, distribute, and sell this software and its 5706f2543Smrg * documentation for any purpose is hereby granted without fee, provided that 6706f2543Smrg * the above copyright notice appear in all copies and that both that 7706f2543Smrg * copyright notice and this permission notice appear in supporting 8706f2543Smrg * documentation, and that the name of Frederic Lepied not be used in 9706f2543Smrg * advertising or publicity pertaining to distribution of the software without 10706f2543Smrg * specific, written prior permission. Frederic Lepied makes no 11706f2543Smrg * representations about the suitability of this software for any purpose. It 12706f2543Smrg * is provided "as is" without express or implied warranty. 13706f2543Smrg * 14706f2543Smrg * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15706f2543Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16706f2543Smrg * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17706f2543Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18706f2543Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19706f2543Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 20706f2543Smrg * PERFORMANCE OF THIS SOFTWARE. 21706f2543Smrg * 22706f2543Smrg */ 23706f2543Smrg 24706f2543Smrg/* 25706f2543Smrg * Copyright (c) 2000-2002 by The XFree86 Project, Inc. 26706f2543Smrg * 27706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a 28706f2543Smrg * copy of this software and associated documentation files (the "Software"), 29706f2543Smrg * to deal in the Software without restriction, including without limitation 30706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 31706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the 32706f2543Smrg * Software is furnished to do so, subject to the following conditions: 33706f2543Smrg * 34706f2543Smrg * The above copyright notice and this permission notice shall be included in 35706f2543Smrg * all copies or substantial portions of the Software. 36706f2543Smrg * 37706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 38706f2543Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 39706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 40706f2543Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 41706f2543Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 42706f2543Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 43706f2543Smrg * OTHER DEALINGS IN THE SOFTWARE. 44706f2543Smrg * 45706f2543Smrg * Except as contained in this notice, the name of the copyright holder(s) 46706f2543Smrg * and author(s) shall not be used in advertising or otherwise to promote 47706f2543Smrg * the sale, use or other dealings in this Software without prior written 48706f2543Smrg * authorization from the copyright holder(s) and author(s). 49706f2543Smrg */ 50706f2543Smrg 51706f2543Smrg 52706f2543Smrg#ifndef _xf86Xinput_h 53706f2543Smrg#define _xf86Xinput_h 54706f2543Smrg 55706f2543Smrg#include "xf86str.h" 56706f2543Smrg#include "inputstr.h" 57706f2543Smrg#include <X11/extensions/XI.h> 58706f2543Smrg#include <X11/extensions/XIproto.h> 59706f2543Smrg#include "XIstubs.h" 60706f2543Smrg 61706f2543Smrg/* Input device flags */ 62706f2543Smrg#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */ 63706f2543Smrg/* the device sends Xinput and core pointer events */ 64706f2543Smrg#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE 65706f2543Smrg 66706f2543Smrg/* This holds the input driver entry and module information. */ 67706f2543Smrgtypedef struct _InputDriverRec { 68706f2543Smrg int driverVersion; 69706f2543Smrg char * driverName; 70706f2543Smrg void (*Identify)(int flags); 71706f2543Smrg int (*PreInit)(struct _InputDriverRec *drv, 72706f2543Smrg struct _InputInfoRec* pInfo, int flags); 73706f2543Smrg void (*UnInit)(struct _InputDriverRec *drv, 74706f2543Smrg struct _InputInfoRec *pInfo, 75706f2543Smrg int flags); 76706f2543Smrg pointer module; 77706f2543Smrg char ** default_options; 78706f2543Smrg} InputDriverRec, *InputDriverPtr; 79706f2543Smrg 80706f2543Smrg/* This is to input devices what the ScrnInfoRec is to screens. */ 81706f2543Smrg 82706f2543Smrgtypedef struct _InputInfoRec { 83706f2543Smrg struct _InputInfoRec *next; 84706f2543Smrg char * name; 85706f2543Smrg char * driver; 86706f2543Smrg 87706f2543Smrg int flags; 88706f2543Smrg 89706f2543Smrg Bool (*device_control)(DeviceIntPtr device, int what); 90706f2543Smrg void (*read_input)(struct _InputInfoRec *local); 91706f2543Smrg int (*control_proc)(struct _InputInfoRec *local, 92706f2543Smrg xDeviceCtl *control); 93706f2543Smrg int (*switch_mode)(ClientPtr client, DeviceIntPtr dev, 94706f2543Smrg int mode); 95706f2543Smrg int (*set_device_valuators) 96706f2543Smrg (struct _InputInfoRec *local, 97706f2543Smrg int *valuators, int first_valuator, 98706f2543Smrg int num_valuators); 99706f2543Smrg 100706f2543Smrg int fd; 101706f2543Smrg DeviceIntPtr dev; 102706f2543Smrg pointer private; 103706f2543Smrg char * type_name; 104706f2543Smrg InputDriverPtr drv; 105706f2543Smrg pointer module; 106706f2543Smrg pointer options; 107706f2543Smrg InputAttributes *attrs; 108706f2543Smrg} *InputInfoPtr; 109706f2543Smrg 110706f2543Smrg/* xf86Globals.c */ 111706f2543Smrgextern InputInfoPtr xf86InputDevs; 112706f2543Smrg 113706f2543Smrg/* xf86Xinput.c */ 114706f2543Smrgextern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute, 115706f2543Smrg int first_valuator, int num_valuators, ...); 116706f2543Smrgextern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute, 117706f2543Smrg int first_valuator, int num_valuators, const int *valuators); 118706f2543Smrgextern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute, 119706f2543Smrg const ValuatorMask *mask); 120706f2543Smrgextern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in, 121706f2543Smrg int first_valuator, int num_valuators, ...); 122706f2543Smrgextern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator, 123706f2543Smrg int num_valuators, const int *valuators); 124706f2543Smrgextern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in, 125706f2543Smrg const ValuatorMask *mask); 126706f2543Smrgextern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button, 127706f2543Smrg int is_down, int first_valuator, int num_valuators, 128706f2543Smrg ...); 129706f2543Smrgextern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button, 130706f2543Smrg int is_down, int first_valuator, int num_valuators, 131706f2543Smrg const int *valuators); 132706f2543Smrgextern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button, 133706f2543Smrg int is_down, const ValuatorMask *mask); 134706f2543Smrgextern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down, 135706f2543Smrg int is_absolute, int first_valuator, int num_valuators, 136706f2543Smrg ...); 137706f2543Smrgextern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down, 138706f2543Smrg int is_absolute, const ValuatorMask *mask); 139706f2543Smrgextern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down, 140706f2543Smrg int is_absolute, int first_valuator, int num_valuators, 141706f2543Smrg const int *valuators); 142706f2543Smrgextern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, 143706f2543Smrg int is_down); 144706f2543Smrgextern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void); 145706f2543Smrgextern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min); 146706f2543Smrgextern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y); 147706f2543Smrgextern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options); 148706f2543Smrgextern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, 149706f2543Smrg int maxval, int resolution, int min_res, 150706f2543Smrg int max_res, int mode); 151706f2543Smrgextern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum); 152706f2543Smrgextern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo); 153706f2543Smrgextern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo); 154706f2543Smrgextern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic); 155706f2543Smrgextern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev); 156706f2543Smrg/* not exported */ 157706f2543Smrgint xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto); 158706f2543SmrgInputInfoPtr xf86AllocateInput(void); 159706f2543Smrg 160706f2543Smrg/* xf86Helper.c */ 161706f2543Smrgextern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags); 162706f2543Smrgextern _X_EXPORT void xf86DeleteInputDriver(int drvIndex); 163706f2543Smrgextern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name); 164706f2543Smrgextern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name); 165706f2543Smrgextern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags); 166706f2543Smrgextern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo); 167706f2543Smrgextern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev, 168706f2543Smrg MessageType type, int verb, 169706f2543Smrg const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5); 170706f2543Smrgextern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev, 171706f2543Smrg MessageType type, 172706f2543Smrg const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4); 173706f2543Smrgextern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev, 174706f2543Smrg MessageType type, 175706f2543Smrg int verb, 176706f2543Smrg const char *format, 177706f2543Smrg va_list args); 178706f2543Smrg 179706f2543Smrg/* xf86Option.c */ 180706f2543Smrgextern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts); 181706f2543Smrg 182706f2543Smrg#endif /* _xf86Xinput_h */ 183