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