1 | /* $XConsortium: xf86Xinput.h /main/11 1996/10/27 11:05:29 kaleb $ */
|
---|
2 | /*
|
---|
3 | * Copyright 1995-1999 by Frederic Lepied, France. <[email protected]>
|
---|
4 | *
|
---|
5 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | * the above copyright notice appear in all copies and that both that
|
---|
8 | * copyright notice and this permission notice appear in supporting
|
---|
9 | * documentation, and that the name of Frederic Lepied not be used in
|
---|
10 | * advertising or publicity pertaining to distribution of the software without
|
---|
11 | * specific, written prior permission. Frederic Lepied makes no
|
---|
12 | * representations about the suitability of this software for any purpose. It
|
---|
13 | * is provided "as is" without express or implied warranty.
|
---|
14 | *
|
---|
15 | * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
17 | * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
19 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
20 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
21 | * PERFORMANCE OF THIS SOFTWARE.
|
---|
22 | *
|
---|
23 | */
|
---|
24 |
|
---|
25 | /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.35 2002/10/11 01:40:31 dawes Exp $ */
|
---|
26 |
|
---|
27 | #ifndef _xf86Xinput_h
|
---|
28 | #define _xf86Xinput_h
|
---|
29 |
|
---|
30 | #ifndef NEED_EVENTS
|
---|
31 | #define NEED_EVENTS
|
---|
32 | #endif
|
---|
33 | #include "xf86str.h"
|
---|
34 | #include "inputstr.h"
|
---|
35 | #ifdef XINPUT
|
---|
36 | #include "extensions/XI.h"
|
---|
37 | #include "extensions/XIproto.h"
|
---|
38 | #include "XIstubs.h"
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | /* Input device flags */
|
---|
42 | #define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
|
---|
43 | #define XI86_CONFIGURED 0x02 /* the device has been configured */
|
---|
44 | #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
|
---|
45 | /* the device sends Xinput and core pointer events */
|
---|
46 | #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
|
---|
47 | /* if the device is the core pointer or is sending core events, and
|
---|
48 | * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
|
---|
49 | * (mouse drag action) are sent. This is mainly to allow a touch screen to be
|
---|
50 | * used with netscape and other browsers which do strange things if the mouse
|
---|
51 | * moves between button down and button up. With a touch screen, this motion
|
---|
52 | * is common due to the user's finger moving slightly.
|
---|
53 | */
|
---|
54 | #define XI86_SEND_DRAG_EVENTS 0x08
|
---|
55 | #define XI86_CORE_POINTER 0x10 /* device is the core pointer */
|
---|
56 | #define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
|
---|
57 | #define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
|
---|
58 | #define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
|
---|
59 |
|
---|
60 | #define XI_PRIVATE(dev) \
|
---|
61 | (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
|
---|
62 |
|
---|
63 | #ifdef DBG
|
---|
64 | #undef DBG
|
---|
65 | #endif
|
---|
66 | #define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
|
---|
67 |
|
---|
68 | #ifdef HAS_MOTION_HISTORY
|
---|
69 | #undef HAS_MOTION_HISTORY
|
---|
70 | #endif
|
---|
71 | #define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
|
---|
72 |
|
---|
73 | #ifdef XINPUT
|
---|
74 | /* This holds the input driver entry and module information. */
|
---|
75 | typedef struct _InputDriverRec {
|
---|
76 | int driverVersion;
|
---|
77 | char * driverName;
|
---|
78 | void (*Identify)(int flags);
|
---|
79 | struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
|
---|
80 | IDevPtr dev, int flags);
|
---|
81 | void (*UnInit)(struct _InputDriverRec *drv,
|
---|
82 | struct _LocalDeviceRec *pInfo,
|
---|
83 | int flags);
|
---|
84 | pointer module;
|
---|
85 | int refCount;
|
---|
86 | } InputDriverRec, *InputDriverPtr;
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | /* This is to input devices what the ScrnInfoRec is to screens. */
|
---|
90 |
|
---|
91 | typedef struct _LocalDeviceRec {
|
---|
92 | struct _LocalDeviceRec *next;
|
---|
93 | char * name;
|
---|
94 | int flags;
|
---|
95 |
|
---|
96 | Bool (*device_control)(DeviceIntPtr device, int what);
|
---|
97 | void (*read_input)(struct _LocalDeviceRec *local);
|
---|
98 | int (*control_proc)(struct _LocalDeviceRec *local,
|
---|
99 | xDeviceCtl *control);
|
---|
100 | void (*close_proc)(struct _LocalDeviceRec *local);
|
---|
101 | int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
|
---|
102 | int mode);
|
---|
103 | Bool (*conversion_proc)(struct _LocalDeviceRec *local,
|
---|
104 | int first, int num, int v0,
|
---|
105 | int v1, int v2, int v3, int v4,
|
---|
106 | int v5, int *x, int *y);
|
---|
107 | Bool (*reverse_conversion_proc)(
|
---|
108 | struct _LocalDeviceRec *local,
|
---|
109 | int x, int y, int *valuators);
|
---|
110 |
|
---|
111 | int fd;
|
---|
112 | Atom atom;
|
---|
113 | DeviceIntPtr dev;
|
---|
114 | pointer private;
|
---|
115 | int private_flags;
|
---|
116 | pointer motion_history;
|
---|
117 | ValuatorMotionProcPtr motion_history_proc;
|
---|
118 | unsigned int history_size; /* only for configuration purpose */
|
---|
119 | unsigned int first;
|
---|
120 | unsigned int last;
|
---|
121 | int old_x;
|
---|
122 | int old_y;
|
---|
123 | float dxremaind;
|
---|
124 | float dyremaind;
|
---|
125 | char * type_name;
|
---|
126 | IntegerFeedbackPtr always_core_feedback;
|
---|
127 | IDevPtr conf_idev;
|
---|
128 | InputDriverPtr drv;
|
---|
129 | pointer module;
|
---|
130 | pointer options;
|
---|
131 | } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
|
---|
132 |
|
---|
133 | typedef struct _DeviceAssocRec
|
---|
134 | {
|
---|
135 | char * config_section_name;
|
---|
136 | LocalDevicePtr (*device_allocate)(void);
|
---|
137 | } DeviceAssocRec, *DeviceAssocPtr;
|
---|
138 |
|
---|
139 | /* xf86Globals.c */
|
---|
140 | extern InputInfoPtr xf86InputDevs;
|
---|
141 |
|
---|
142 | /* xf86Xinput.c */
|
---|
143 | int xf86IsCorePointer(DeviceIntPtr dev);
|
---|
144 | int xf86IsCoreKeyboard(DeviceIntPtr dev);
|
---|
145 | void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
|
---|
146 | #define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
|
---|
147 |
|
---|
148 | void InitExtInput(void);
|
---|
149 | Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
|
---|
150 | void xf86eqEnqueue(struct _xEvent *event);
|
---|
151 | void xf86eqProcessInputEvents (void);
|
---|
152 | void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
---|
153 | void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
|
---|
154 | int first_valuator, int num_valuators, ...);
|
---|
155 | void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
|
---|
156 | int first_valuator, int num_valuators, ...);
|
---|
157 | void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
|
---|
158 | int is_down, int first_valuator, int num_valuators,
|
---|
159 | ...);
|
---|
160 | void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
|
---|
161 | int is_absolute, int first_valuator, int num_valuators,
|
---|
162 | ...);
|
---|
163 | void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
|
---|
164 | int is_down);
|
---|
165 | void xf86MotionHistoryAllocate(LocalDevicePtr local);
|
---|
166 | int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
|
---|
167 | unsigned long start, unsigned long stop,
|
---|
168 | ScreenPtr pScreen);
|
---|
169 | void xf86XinputFinalizeInit(DeviceIntPtr dev);
|
---|
170 | Bool xf86CheckButton(int button, int down);
|
---|
171 | void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
|
---|
172 | LocalDevicePtr xf86FirstLocalDevice(void);
|
---|
173 | int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
|
---|
174 | void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
|
---|
175 | void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
|
---|
176 | void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
|
---|
177 | int maxval, int resolution, int min_res,
|
---|
178 | int max_res);
|
---|
179 | void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
|
---|
180 | void xf86AddEnabledDevice(InputInfoPtr pInfo);
|
---|
181 | void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
|
---|
182 |
|
---|
183 | /* xf86Helper.c */
|
---|
184 | void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
|
---|
185 | void xf86DeleteInputDriver(int drvIndex);
|
---|
186 | InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
|
---|
187 | void xf86DeleteInput(InputInfoPtr pInp, int flags);
|
---|
188 |
|
---|
189 | /* xf86Option.c */
|
---|
190 | void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
|
---|
191 | pointer extraOpts);
|
---|
192 |
|
---|
193 | #endif /* _xf86Xinput_h */
|
---|