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