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 | #ifndef _xf86Xinput_h
|
---|
52 | #define _xf86Xinput_h
|
---|
53 |
|
---|
54 | #include "xf86str.h"
|
---|
55 | #include "inputstr.h"
|
---|
56 | #include <X11/extensions/XI.h>
|
---|
57 | #include <X11/extensions/XIproto.h>
|
---|
58 | #include "XIstubs.h"
|
---|
59 |
|
---|
60 | /* Input device flags */
|
---|
61 | #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
|
---|
62 | /* the device sends Xinput and core pointer events */
|
---|
63 | #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
|
---|
64 | /* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */
|
---|
65 | /* server-internal only */
|
---|
66 | #define XI86_DEVICE_DISABLED 0x10 /* device was disabled before vt switch */
|
---|
67 | #define XI86_SERVER_FD 0x20 /* fd is managed by xserver */
|
---|
68 |
|
---|
69 | /* Input device driver capabilities */
|
---|
70 | #define XI86_DRV_CAP_SERVER_FD 0x01
|
---|
71 |
|
---|
72 | /* This holds the input driver entry and module information. */
|
---|
73 | typedef struct _InputDriverRec {
|
---|
74 | int driverVersion;
|
---|
75 | const char *driverName;
|
---|
76 | void (*Identify) (int flags);
|
---|
77 | int (*PreInit) (struct _InputDriverRec * drv,
|
---|
78 | struct _InputInfoRec * pInfo, int flags);
|
---|
79 | void (*UnInit) (struct _InputDriverRec * drv,
|
---|
80 | struct _InputInfoRec * pInfo, int flags);
|
---|
81 | void *module;
|
---|
82 | const char **default_options;
|
---|
83 | int capabilities;
|
---|
84 | } InputDriverRec, *InputDriverPtr;
|
---|
85 |
|
---|
86 | /* This is to input devices what the ScrnInfoRec is to screens. */
|
---|
87 |
|
---|
88 | typedef struct _InputInfoRec {
|
---|
89 | struct _InputInfoRec *next;
|
---|
90 | char *name;
|
---|
91 | char *driver;
|
---|
92 |
|
---|
93 | int flags;
|
---|
94 |
|
---|
95 | Bool (*device_control) (DeviceIntPtr device, int what);
|
---|
96 | void (*read_input) (struct _InputInfoRec * local);
|
---|
97 | int (*control_proc) (struct _InputInfoRec * local, xDeviceCtl * control);
|
---|
98 | int (*switch_mode) (ClientPtr client, DeviceIntPtr dev, int mode);
|
---|
99 | int (*set_device_valuators)
|
---|
100 | (struct _InputInfoRec * local,
|
---|
101 | int *valuators, int first_valuator, int num_valuators);
|
---|
102 |
|
---|
103 | int fd;
|
---|
104 | int major;
|
---|
105 | int minor;
|
---|
106 | DeviceIntPtr dev;
|
---|
107 | void *private;
|
---|
108 | const char *type_name;
|
---|
109 | InputDriverPtr drv;
|
---|
110 | void *module;
|
---|
111 | XF86OptionPtr options;
|
---|
112 | InputAttributes *attrs;
|
---|
113 | } *InputInfoPtr;
|
---|
114 |
|
---|
115 | /* xf86Globals.c */
|
---|
116 | extern InputInfoPtr xf86InputDevs;
|
---|
117 |
|
---|
118 | /* xf86Xinput.c */
|
---|
119 | extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
|
---|
120 | int first_valuator, int num_valuators,
|
---|
121 | ...);
|
---|
122 | extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
|
---|
123 | int first_valuator,
|
---|
124 | int num_valuators,
|
---|
125 | const int *valuators);
|
---|
126 | extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
|
---|
127 | const ValuatorMask *mask);
|
---|
128 | extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
|
---|
129 | int first_valuator,
|
---|
130 | int num_valuators, ...);
|
---|
131 | extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in,
|
---|
132 | int first_valuator,
|
---|
133 | int num_valuators,
|
---|
134 | const int *valuators);
|
---|
135 | extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
|
---|
136 | const ValuatorMask *mask);
|
---|
137 | extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute,
|
---|
138 | int button, int is_down,
|
---|
139 | int first_valuator, int num_valuators,
|
---|
140 | ...);
|
---|
141 | extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute,
|
---|
142 | int button, int is_down,
|
---|
143 | int first_valuator,
|
---|
144 | int num_valuators,
|
---|
145 | const int *valuators);
|
---|
146 | extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute,
|
---|
147 | int button, int is_down,
|
---|
148 | const ValuatorMask *mask);
|
---|
149 | extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device,
|
---|
150 | unsigned int key_code, int is_down,
|
---|
151 | int is_absolute, int first_valuator,
|
---|
152 | int num_valuators, ...);
|
---|
153 | extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device,
|
---|
154 | unsigned int key_code, int is_down,
|
---|
155 | int is_absolute,
|
---|
156 | const ValuatorMask *mask);
|
---|
157 | extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device,
|
---|
158 | unsigned int key_code, int is_down,
|
---|
159 | int is_absolute, int first_valuator,
|
---|
160 | int num_valuators,
|
---|
161 | const int *valuators);
|
---|
162 | extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device,
|
---|
163 | unsigned int key_code, int is_down);
|
---|
164 | extern _X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid,
|
---|
165 | uint16_t type, uint32_t flags,
|
---|
166 | const ValuatorMask *mask);
|
---|
167 | extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
|
---|
168 | extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max,
|
---|
169 | int from_min);
|
---|
170 | extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo,
|
---|
171 | XF86OptionPtr options);
|
---|
172 | extern _X_EXPORT Bool xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum,
|
---|
173 | Atom label, int minval,
|
---|
174 | int maxval, int resolution,
|
---|
175 | int min_res, int max_res,
|
---|
176 | int mode);
|
---|
177 | extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
|
---|
178 | extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
|
---|
179 | extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
|
---|
180 | extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
|
---|
181 | extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
|
---|
182 | extern _X_EXPORT void xf86InputEnableVTProbe(void);
|
---|
183 |
|
---|
184 | /* not exported */
|
---|
185 | int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
|
---|
186 | InputInfoPtr xf86AllocateInput(void);
|
---|
187 |
|
---|
188 | /* xf86Helper.c */
|
---|
189 | extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, void *module,
|
---|
190 | int flags);
|
---|
191 | extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
|
---|
192 | extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
|
---|
193 | extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
|
---|
194 | extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
|
---|
195 | extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
|
---|
196 | extern _X_EXPORT void
|
---|
197 | xf86IDrvMsgVerb(InputInfoPtr dev,
|
---|
198 | MessageType type, int verb, const char *format, ...)
|
---|
199 | _X_ATTRIBUTE_PRINTF(4, 5);
|
---|
200 | extern _X_EXPORT void
|
---|
201 | xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
|
---|
202 | _X_ATTRIBUTE_PRINTF(3, 4);
|
---|
203 | extern _X_EXPORT void
|
---|
204 | xf86VIDrvMsgVerb(InputInfoPtr dev,
|
---|
205 | MessageType type, int verb, const char *format, va_list args)
|
---|
206 | _X_ATTRIBUTE_PRINTF(4, 0);
|
---|
207 |
|
---|
208 | /* xf86Option.c */
|
---|
209 | extern _X_EXPORT void
|
---|
210 | xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
|
---|
211 |
|
---|
212 | #endif /* _xf86Xinput_h */
|
---|