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 | /*
|
---|
26 | * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
|
---|
27 | *
|
---|
28 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
29 | * copy of this software and associated documentation files (the "Software"),
|
---|
30 | * to deal in the Software without restriction, including without limitation
|
---|
31 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
32 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
33 | * Software is furnished to do so, subject to the following conditions:
|
---|
34 | *
|
---|
35 | * The above copyright notice and this permission notice shall be included in
|
---|
36 | * all copies or substantial portions of the Software.
|
---|
37 | *
|
---|
38 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
39 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
40 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
41 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
42 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
43 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
44 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
45 | *
|
---|
46 | * Except as contained in this notice, the name of the copyright holder(s)
|
---|
47 | * and author(s) shall not be used in advertising or otherwise to promote
|
---|
48 | * the sale, use or other dealings in this Software without prior written
|
---|
49 | * authorization from the copyright holder(s) and author(s).
|
---|
50 | */
|
---|
51 |
|
---|
52 |
|
---|
53 | #ifndef _xf86Xinput_h
|
---|
54 | #define _xf86Xinput_h
|
---|
55 |
|
---|
56 | #ifndef NEED_EVENTS
|
---|
57 | #define NEED_EVENTS
|
---|
58 | #endif
|
---|
59 | #include "xf86str.h"
|
---|
60 | #include "inputstr.h"
|
---|
61 | #ifdef XINPUT
|
---|
62 | #include <X11/extensions/XI.h>
|
---|
63 | #include <X11/extensions/XIproto.h>
|
---|
64 | #include "XIstubs.h"
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | /* Input device flags */
|
---|
68 | #define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
|
---|
69 | #define XI86_CONFIGURED 0x02 /* the device has been configured */
|
---|
70 | #define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
|
---|
71 | /* the device sends Xinput and core pointer events */
|
---|
72 | #define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
|
---|
73 | /* if the device is the core pointer or is sending core events, and
|
---|
74 | * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
|
---|
75 | * (mouse drag action) are sent. This is mainly to allow a touch screen to be
|
---|
76 | * used with netscape and other browsers which do strange things if the mouse
|
---|
77 | * moves between button down and button up. With a touch screen, this motion
|
---|
78 | * is common due to the user's finger moving slightly.
|
---|
79 | */
|
---|
80 | #define XI86_SEND_DRAG_EVENTS 0x08
|
---|
81 | #define XI86_CORE_POINTER 0x10 /* device is the core pointer */
|
---|
82 | #define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
|
---|
83 | #define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
|
---|
84 | #define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
|
---|
85 |
|
---|
86 | #define XI_PRIVATE(dev) \
|
---|
87 | (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
|
---|
88 |
|
---|
89 | #ifdef DBG
|
---|
90 | #undef DBG
|
---|
91 | #endif
|
---|
92 | #define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
|
---|
93 |
|
---|
94 | #ifdef HAS_MOTION_HISTORY
|
---|
95 | #undef HAS_MOTION_HISTORY
|
---|
96 | #endif
|
---|
97 | #define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
|
---|
98 |
|
---|
99 | #ifdef XINPUT
|
---|
100 | /* This holds the input driver entry and module information. */
|
---|
101 | typedef struct _InputDriverRec {
|
---|
102 | int driverVersion;
|
---|
103 | char * driverName;
|
---|
104 | void (*Identify)(int flags);
|
---|
105 | struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
|
---|
106 | IDevPtr dev, int flags);
|
---|
107 | void (*UnInit)(struct _InputDriverRec *drv,
|
---|
108 | struct _LocalDeviceRec *pInfo,
|
---|
109 | int flags);
|
---|
110 | pointer module;
|
---|
111 | int refCount;
|
---|
112 | } InputDriverRec, *InputDriverPtr;
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | /* This is to input devices what the ScrnInfoRec is to screens. */
|
---|
116 |
|
---|
117 | typedef struct _LocalDeviceRec {
|
---|
118 | struct _LocalDeviceRec *next;
|
---|
119 | char * name;
|
---|
120 | int flags;
|
---|
121 |
|
---|
122 | Bool (*device_control)(DeviceIntPtr device, int what);
|
---|
123 | void (*read_input)(struct _LocalDeviceRec *local);
|
---|
124 | int (*control_proc)(struct _LocalDeviceRec *local,
|
---|
125 | xDeviceCtl *control);
|
---|
126 | void (*close_proc)(struct _LocalDeviceRec *local);
|
---|
127 | int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
|
---|
128 | int mode);
|
---|
129 | Bool (*conversion_proc)(struct _LocalDeviceRec *local,
|
---|
130 | int first, int num, int v0,
|
---|
131 | int v1, int v2, int v3, int v4,
|
---|
132 | int v5, int *x, int *y);
|
---|
133 | Bool (*reverse_conversion_proc)(
|
---|
134 | struct _LocalDeviceRec *local,
|
---|
135 | int x, int y, int *valuators);
|
---|
136 |
|
---|
137 | int fd;
|
---|
138 | Atom atom;
|
---|
139 | DeviceIntPtr dev;
|
---|
140 | pointer private;
|
---|
141 | int private_flags;
|
---|
142 | pointer motion_history;
|
---|
143 | ValuatorMotionProcPtr motion_history_proc;
|
---|
144 | unsigned int history_size; /* only for configuration purpose */
|
---|
145 | unsigned int first;
|
---|
146 | unsigned int last;
|
---|
147 | int old_x;
|
---|
148 | int old_y;
|
---|
149 | float dxremaind;
|
---|
150 | float dyremaind;
|
---|
151 | char * type_name;
|
---|
152 | IntegerFeedbackPtr always_core_feedback;
|
---|
153 | IDevPtr conf_idev;
|
---|
154 | InputDriverPtr drv;
|
---|
155 | pointer module;
|
---|
156 | pointer options;
|
---|
157 | } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
|
---|
158 |
|
---|
159 | typedef struct _DeviceAssocRec
|
---|
160 | {
|
---|
161 | char * config_section_name;
|
---|
162 | LocalDevicePtr (*device_allocate)(void);
|
---|
163 | } DeviceAssocRec, *DeviceAssocPtr;
|
---|
164 |
|
---|
165 | /* xf86Globals.c */
|
---|
166 | extern InputInfoPtr xf86InputDevs;
|
---|
167 |
|
---|
168 | /* xf86Xinput.c */
|
---|
169 | int xf86IsCorePointer(DeviceIntPtr dev);
|
---|
170 | int xf86IsCoreKeyboard(DeviceIntPtr dev);
|
---|
171 | void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
|
---|
172 | #define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
|
---|
173 |
|
---|
174 | void InitExtInput(void);
|
---|
175 | Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
|
---|
176 | void xf86eqEnqueue(struct _xEvent *event);
|
---|
177 | void xf86eqProcessInputEvents (void);
|
---|
178 | void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
---|
179 | void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
|
---|
180 | int first_valuator, int num_valuators, ...);
|
---|
181 | void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
|
---|
182 | int first_valuator, int num_valuators, ...);
|
---|
183 | void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
|
---|
184 | int is_down, int first_valuator, int num_valuators,
|
---|
185 | ...);
|
---|
186 | void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
|
---|
187 | int is_absolute, int first_valuator, int num_valuators,
|
---|
188 | ...);
|
---|
189 | void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
|
---|
190 | int is_down);
|
---|
191 | void xf86MotionHistoryAllocate(LocalDevicePtr local);
|
---|
192 | int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
|
---|
193 | unsigned long start, unsigned long stop,
|
---|
194 | ScreenPtr pScreen);
|
---|
195 | void xf86XinputFinalizeInit(DeviceIntPtr dev);
|
---|
196 | void xf86ActivateDevice(LocalDevicePtr local);
|
---|
197 | Bool xf86CheckButton(int button, int down);
|
---|
198 | void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
|
---|
199 | LocalDevicePtr xf86FirstLocalDevice(void);
|
---|
200 | int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
|
---|
201 | void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
|
---|
202 | void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
|
---|
203 | void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
|
---|
204 | int maxval, int resolution, int min_res,
|
---|
205 | int max_res);
|
---|
206 | void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
|
---|
207 | void xf86AddEnabledDevice(InputInfoPtr pInfo);
|
---|
208 | void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
|
---|
209 |
|
---|
210 | /* xf86Helper.c */
|
---|
211 | void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
|
---|
212 | void xf86DeleteInputDriver(int drvIndex);
|
---|
213 | InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
|
---|
214 | void xf86DeleteInput(InputInfoPtr pInp, int flags);
|
---|
215 |
|
---|
216 | /* xf86Option.c */
|
---|
217 | void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
|
---|
218 | pointer extraOpts);
|
---|
219 |
|
---|
220 | #endif /* _xf86Xinput_h */
|
---|