1 | /*
|
---|
2 | * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
|
---|
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 | #ifndef NEED_EVENTS
|
---|
56 | #define NEED_EVENTS
|
---|
57 | #endif
|
---|
58 | #include "xf86str.h"
|
---|
59 | #include "inputstr.h"
|
---|
60 | #ifdef XINPUT
|
---|
61 | #include <X11/extensions/XI.h>
|
---|
62 | #include <X11/extensions/XIproto.h>
|
---|
63 | #include "XIstubs.h"
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | /* Input device flags */
|
---|
67 | #define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
|
---|
68 | #define XI86_CONFIGURED 0x02 /* the device has been configured */
|
---|
69 | #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
|
---|
70 | /* the device sends Xinput and core pointer events */
|
---|
71 | #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
|
---|
72 | /* if the device is the core pointer or is sending core events, and
|
---|
73 | * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
|
---|
74 | * (mouse drag action) are sent. This is mainly to allow a touch screen to be
|
---|
75 | * used with netscape and other browsers which do strange things if the mouse
|
---|
76 | * moves between button down and button up. With a touch screen, this motion
|
---|
77 | * is common due to the user's finger moving slightly.
|
---|
78 | */
|
---|
79 | #define XI86_SEND_DRAG_EVENTS 0x08
|
---|
80 | #define XI86_CORE_POINTER 0x10 /* device is the core pointer */
|
---|
81 | #define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
|
---|
82 | #define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
|
---|
83 | #define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
|
---|
84 |
|
---|
85 | #define XI_PRIVATE(dev) \
|
---|
86 | (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
|
---|
87 |
|
---|
88 | /* Stupid API backwards-compatibility. */
|
---|
89 | #define TS_Raw 60
|
---|
90 | #define TS_Scaled 61
|
---|
91 |
|
---|
92 | #ifdef XINPUT
|
---|
93 | /* This holds the input driver entry and module information. */
|
---|
94 | typedef struct _InputDriverRec {
|
---|
95 | int driverVersion;
|
---|
96 | char * driverName;
|
---|
97 | void (*Identify)(int flags);
|
---|
98 | struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
|
---|
99 | IDevPtr dev, int flags);
|
---|
100 | void (*UnInit)(struct _InputDriverRec *drv,
|
---|
101 | struct _LocalDeviceRec *pInfo,
|
---|
102 | int flags);
|
---|
103 | pointer module;
|
---|
104 | int refCount;
|
---|
105 | } InputDriverRec, *InputDriverPtr;
|
---|
106 | #endif
|
---|
107 |
|
---|
108 | /* This is to input devices what the ScrnInfoRec is to screens. */
|
---|
109 |
|
---|
110 | typedef struct _LocalDeviceRec {
|
---|
111 | struct _LocalDeviceRec *next;
|
---|
112 | char * name;
|
---|
113 | int flags;
|
---|
114 |
|
---|
115 | Bool (*device_control)(DeviceIntPtr device, int what);
|
---|
116 | void (*read_input)(struct _LocalDeviceRec *local);
|
---|
117 | int (*control_proc)(struct _LocalDeviceRec *local,
|
---|
118 | xDeviceCtl *control);
|
---|
119 | void (*close_proc)(struct _LocalDeviceRec *local);
|
---|
120 | int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
|
---|
121 | int mode);
|
---|
122 | Bool (*conversion_proc)(struct _LocalDeviceRec *local,
|
---|
123 | int first, int num, int v0,
|
---|
124 | int v1, int v2, int v3, int v4,
|
---|
125 | int v5, int *x, int *y);
|
---|
126 | Bool (*reverse_conversion_proc)(
|
---|
127 | struct _LocalDeviceRec *local,
|
---|
128 | int x, int y, int *valuators);
|
---|
129 | int (*set_device_valuators)
|
---|
130 | (struct _LocalDeviceRec *local,
|
---|
131 | int *valuators, int first_valuator,
|
---|
132 | int num_valuators);
|
---|
133 |
|
---|
134 | int fd;
|
---|
135 | Atom atom;
|
---|
136 | DeviceIntPtr dev;
|
---|
137 | pointer private;
|
---|
138 | int private_flags;
|
---|
139 | unsigned int first;
|
---|
140 | unsigned int last;
|
---|
141 | int old_x;
|
---|
142 | int old_y;
|
---|
143 | char * type_name;
|
---|
144 | IntegerFeedbackPtr always_core_feedback;
|
---|
145 | IDevPtr conf_idev;
|
---|
146 | InputDriverPtr drv;
|
---|
147 | pointer module;
|
---|
148 | pointer options;
|
---|
149 | unsigned int history_size;
|
---|
150 | } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
|
---|
151 |
|
---|
152 | typedef struct _DeviceAssocRec
|
---|
153 | {
|
---|
154 | char * config_section_name;
|
---|
155 | LocalDevicePtr (*device_allocate)(void);
|
---|
156 | } DeviceAssocRec, *DeviceAssocPtr;
|
---|
157 |
|
---|
158 | /* xf86Globals.c */
|
---|
159 | extern InputInfoPtr xf86InputDevs;
|
---|
160 |
|
---|
161 | /* xf86Xinput.c */
|
---|
162 | void InitExtInput(void);
|
---|
163 | void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
|
---|
164 | int first_valuator, int num_valuators, ...);
|
---|
165 | void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
|
---|
166 | int first_valuator, int num_valuators, int *valuators);
|
---|
167 | void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
|
---|
168 | int first_valuator, int num_valuators, ...);
|
---|
169 | void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
|
---|
170 | int is_down, int first_valuator, int num_valuators,
|
---|
171 | ...);
|
---|
172 | void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
|
---|
173 | int is_absolute, int first_valuator, int num_valuators,
|
---|
174 | ...);
|
---|
175 | void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
|
---|
176 | int is_down);
|
---|
177 | void xf86XinputFinalizeInit(DeviceIntPtr dev);
|
---|
178 | void xf86ActivateDevice(LocalDevicePtr local);
|
---|
179 | Bool xf86CheckButton(int button, int down);
|
---|
180 | void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
|
---|
181 | LocalDevicePtr xf86FirstLocalDevice(void);
|
---|
182 | int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
|
---|
183 | void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
|
---|
184 | void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
|
---|
185 | void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
|
---|
186 | int maxval, int resolution, int min_res,
|
---|
187 | int max_res);
|
---|
188 | void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
|
---|
189 | void xf86AddEnabledDevice(InputInfoPtr pInfo);
|
---|
190 | void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
|
---|
191 | void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
|
---|
192 | void xf86EnableDevice(DeviceIntPtr dev);
|
---|
193 |
|
---|
194 | /* xf86Helper.c */
|
---|
195 | void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
|
---|
196 | void xf86DeleteInputDriver(int drvIndex);
|
---|
197 | InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
|
---|
198 | InputDriverPtr xf86LookupInputDriver(const char *name);
|
---|
199 | InputInfoPtr xf86LookupInput(const char *name);
|
---|
200 | void xf86DeleteInput(InputInfoPtr pInp, int flags);
|
---|
201 | void xf86MotionHistoryAllocate(LocalDevicePtr local);
|
---|
202 | int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
|
---|
203 | unsigned long start, unsigned long stop,
|
---|
204 | ScreenPtr pScreen);
|
---|
205 |
|
---|
206 | /* xf86Option.c */
|
---|
207 | void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
|
---|
208 | pointer extraOpts);
|
---|
209 |
|
---|
210 |
|
---|
211 | /* Legacy hatred */
|
---|
212 | #define SendCoreEvents 59
|
---|
213 | #define DontSendCoreEvents 60
|
---|
214 |
|
---|
215 | #endif /* _xf86Xinput_h */
|
---|