1 | /*
|
---|
2 | * Copyright 1995-1999 by Frederic Lepied, France. <[email protected]>
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
5 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
6 | * the above copyright notice appear in all copies and that both that
|
---|
7 | * copyright notice and this permission notice appear in supporting
|
---|
8 | * documentation, and that the name of Frederic Lepied not be used in
|
---|
9 | * advertising or publicity pertaining to distribution of the software without
|
---|
10 | * specific, written prior permission. Frederic Lepied makes no
|
---|
11 | * representations about the suitability of this software for any purpose. It
|
---|
12 | * is provided "as is" without express or implied warranty.
|
---|
13 | *
|
---|
14 | * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
16 | * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
20 | * PERFORMANCE OF THIS SOFTWARE.
|
---|
21 | *
|
---|
22 | */
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
|
---|
26 | *
|
---|
27 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
28 | * copy of this software and associated documentation files (the "Software"),
|
---|
29 | * to deal in the Software without restriction, including without limitation
|
---|
30 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
31 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
32 | * Software is furnished to do so, subject to the following conditions:
|
---|
33 | *
|
---|
34 | * The above copyright notice and this permission notice shall be included in
|
---|
35 | * all copies or substantial portions of the Software.
|
---|
36 | *
|
---|
37 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
38 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
39 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
40 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
41 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
42 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
43 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
44 | *
|
---|
45 | * Except as contained in this notice, the name of the copyright holder(s)
|
---|
46 | * and author(s) shall not be used in advertising or otherwise to promote
|
---|
47 | * the sale, use or other dealings in this Software without prior written
|
---|
48 | * authorization from the copyright holder(s) and author(s).
|
---|
49 | */
|
---|
50 |
|
---|
51 |
|
---|
52 | #ifndef _xf86Xinput_h
|
---|
53 | #define _xf86Xinput_h
|
---|
54 |
|
---|
55 | #include "xf86str.h"
|
---|
56 | #include "inputstr.h"
|
---|
57 | #include <X11/extensions/XI.h>
|
---|
58 | #include <X11/extensions/XIproto.h>
|
---|
59 | #include "XIstubs.h"
|
---|
60 |
|
---|
61 | /* Input device flags */
|
---|
62 | #define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
|
---|
63 | #define XI86_CONFIGURED 0x02 /* the device has been configured */
|
---|
64 | #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
|
---|
65 | /* the device sends Xinput and core pointer events */
|
---|
66 | #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
|
---|
67 | /* if the device is the core pointer or is sending core events, and
|
---|
68 | * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
|
---|
69 | * (mouse drag action) are sent. This is mainly to allow a touch screen to be
|
---|
70 | * used with netscape and other browsers which do strange things if the mouse
|
---|
71 | * moves between button down and button up. With a touch screen, this motion
|
---|
72 | * is common due to the user's finger moving slightly.
|
---|
73 | */
|
---|
74 | #define XI86_SEND_DRAG_EVENTS 0x08
|
---|
75 | #define XI86_CORE_POINTER 0x10 /* device is the core pointer */
|
---|
76 | #define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
|
---|
77 | #define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
|
---|
78 | #define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
|
---|
79 |
|
---|
80 | #define XI_PRIVATE(dev) \
|
---|
81 | (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
|
---|
82 |
|
---|
83 | /* Valuator verification macro */
|
---|
84 | #define XI_VERIFY_VALUATORS(num_valuators) \
|
---|
85 | if (num_valuators > MAX_VALUATORS) { \
|
---|
86 | xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \
|
---|
87 | " MAX_VALUATORS\n", __FUNCTION__, num_valuators); \
|
---|
88 | return; \
|
---|
89 | }
|
---|
90 |
|
---|
91 | /* Stupid API backwards-compatibility. */
|
---|
92 | #define TS_Raw 60
|
---|
93 | #define TS_Scaled 61
|
---|
94 |
|
---|
95 | /* This holds the input driver entry and module information. */
|
---|
96 | typedef struct _InputDriverRec {
|
---|
97 | int driverVersion;
|
---|
98 | char * driverName;
|
---|
99 | void (*Identify)(int flags);
|
---|
100 | struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
|
---|
101 | IDevPtr dev, int flags);
|
---|
102 | void (*UnInit)(struct _InputDriverRec *drv,
|
---|
103 | struct _LocalDeviceRec *pInfo,
|
---|
104 | int flags);
|
---|
105 | pointer module;
|
---|
106 | int refCount;
|
---|
107 | } InputDriverRec, *InputDriverPtr;
|
---|
108 |
|
---|
109 | /* This is to input devices what the ScrnInfoRec is to screens. */
|
---|
110 |
|
---|
111 | typedef struct _LocalDeviceRec {
|
---|
112 | struct _LocalDeviceRec *next;
|
---|
113 | char * name;
|
---|
114 | int flags;
|
---|
115 |
|
---|
116 | Bool (*device_control)(DeviceIntPtr device, int what);
|
---|
117 | void (*read_input)(struct _LocalDeviceRec *local);
|
---|
118 | int (*control_proc)(struct _LocalDeviceRec *local,
|
---|
119 | xDeviceCtl *control);
|
---|
120 | void (*close_proc)(struct _LocalDeviceRec *local);
|
---|
121 | int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
|
---|
122 | int mode);
|
---|
123 | Bool (*conversion_proc)(struct _LocalDeviceRec *local,
|
---|
124 | int first, int num, int v0,
|
---|
125 | int v1, int v2, int v3, int v4,
|
---|
126 | int v5, int *x, int *y);
|
---|
127 | Bool (*reverse_conversion_proc)(
|
---|
128 | struct _LocalDeviceRec *local,
|
---|
129 | int x, int y, int *valuators);
|
---|
130 | int (*set_device_valuators)
|
---|
131 | (struct _LocalDeviceRec *local,
|
---|
132 | int *valuators, int first_valuator,
|
---|
133 | int num_valuators);
|
---|
134 |
|
---|
135 | int fd;
|
---|
136 | Atom atom;
|
---|
137 | DeviceIntPtr dev;
|
---|
138 | pointer private;
|
---|
139 | int private_flags;
|
---|
140 | unsigned int first;
|
---|
141 | unsigned int last;
|
---|
142 | int old_x;
|
---|
143 | int old_y;
|
---|
144 | char * type_name;
|
---|
145 | IntegerFeedbackPtr always_core_feedback;
|
---|
146 | IDevPtr conf_idev;
|
---|
147 | InputDriverPtr drv;
|
---|
148 | pointer module;
|
---|
149 | pointer options;
|
---|
150 | unsigned int history_size;
|
---|
151 | InputAttributes *attrs;
|
---|
152 | } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
|
---|
153 |
|
---|
154 | typedef struct _DeviceAssocRec
|
---|
155 | {
|
---|
156 | char * config_section_name;
|
---|
157 | LocalDevicePtr (*device_allocate)(void);
|
---|
158 | } DeviceAssocRec, *DeviceAssocPtr;
|
---|
159 |
|
---|
160 | /* xf86Globals.c */
|
---|
161 | extern _X_EXPORT InputInfoPtr xf86InputDevs;
|
---|
162 |
|
---|
163 | /* xf86Xinput.c */
|
---|
164 | extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
|
---|
165 | int first_valuator, int num_valuators, ...);
|
---|
166 | extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
|
---|
167 | int first_valuator, int num_valuators, int *valuators);
|
---|
168 | extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
|
---|
169 | int first_valuator, int num_valuators, ...);
|
---|
170 | extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
|
---|
171 | int num_valuators, int *valuators);
|
---|
172 | extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
|
---|
173 | int is_down, int first_valuator, int num_valuators,
|
---|
174 | ...);
|
---|
175 | extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
|
---|
176 | int is_down, int first_valuator, int num_valuators,
|
---|
177 | int *valuators);
|
---|
178 | extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
|
---|
179 | int is_absolute, int first_valuator, int num_valuators,
|
---|
180 | ...);
|
---|
181 | extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
|
---|
182 | int is_absolute, int first_valuator, int num_valuators,
|
---|
183 | int *valuators);
|
---|
184 | extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
|
---|
185 | int is_down);
|
---|
186 | extern _X_EXPORT int xf86ActivateDevice(LocalDevicePtr local);
|
---|
187 | extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
|
---|
188 | extern _X_EXPORT int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
|
---|
189 | extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
|
---|
190 | extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
|
---|
191 | extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
|
---|
192 | int maxval, int resolution, int min_res,
|
---|
193 | int max_res);
|
---|
194 | extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
|
---|
195 | extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
|
---|
196 | extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
|
---|
197 | extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
|
---|
198 | extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
|
---|
199 | /* not exported */
|
---|
200 | int xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL is_auto);
|
---|
201 |
|
---|
202 | /* xf86Helper.c */
|
---|
203 | extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
|
---|
204 | extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
|
---|
205 | extern _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
|
---|
206 | extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
|
---|
207 | extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
|
---|
208 | extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
|
---|
209 | extern _X_EXPORT void xf86MotionHistoryAllocate(LocalDevicePtr local);
|
---|
210 |
|
---|
211 | /* xf86Option.c */
|
---|
212 | extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
|
---|
213 | pointer extraOpts);
|
---|
214 |
|
---|
215 |
|
---|
216 | /* Legacy hatred */
|
---|
217 | #define SendCoreEvents 59
|
---|
218 | #define DontSendCoreEvents 60
|
---|
219 |
|
---|
220 | #endif /* _xf86Xinput_h */
|
---|