summaryrefslogtreecommitdiff
path: root/hw/xfree86/common/xf86Xinput.h
blob: b2bb8832f30b0857cc9bfce3020b7af45a169785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/* $Xorg: xf86Xinput.h,v 1.3 2000/08/17 19:50:31 cpqbld Exp $ */
/*
 * Copyright 1995,1996 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
 *                                                                            
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is  hereby granted without fee, provided that
 * the  above copyright   notice appear  in   all  copies and  that both  that
 * copyright  notice   and   this  permission   notice  appear  in  supporting
 * documentation, and that   the  name of  Frederic   Lepied not  be  used  in
 * advertising or publicity pertaining to distribution of the software without
 * specific,  written      prior  permission.     Frederic  Lepied   makes  no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.                   
 *                                                                            
 * FREDERIC  LEPIED DISCLAIMS ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
 * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
 * EVENT  SHALL FREDERIC  LEPIED BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
 * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 */

/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.14.2.1 1997/05/12 12:52:29 hohndel Exp $ */

#ifndef _xf86Xinput_h
#define _xf86Xinput_h

#ifndef NEED_EVENTS
#define NEED_EVENTS
#endif
#include "X.h"
#include "Xproto.h"
#include "inputstr.h"
#include "XI.h"
#include "XIproto.h"
#include "XIstubs.h"

#define XI86_NO_OPEN_ON_INIT    1 /* open the device only when needed */
#define XI86_CONFIGURED         2 /* the device has been configured */
#define XI86_ALWAYS_CORE	4 /* the device always controls the pointer */

#ifdef PRIVATE
#undef PRIVATE
#endif
#define PRIVATE(dev) (((LocalDevicePtr)((dev)->public.devicePrivate))->private)

#ifdef HAS_MOTION_HISTORY
#undef HAS_MOTION_HISTORY
#endif
#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)

typedef struct _LocalDeviceRec {  
  char		*name;
  int           flags;
  Bool		(*device_config)(
#if NeedNestedPrototypes
    struct _LocalDeviceRec** /*array*/,
    int /*index*/,
    int /*max*/,
    LexPtr /*val*/
#endif
    );
  Bool		(*device_control)(
#if NeedNestedPrototypes
    DeviceIntPtr /*device*/,
    int /*what*/
#endif
    );
  void		(*read_input)(
#if NeedNestedPrototypes
    struct _LocalDeviceRec* /*local*/
#endif
    );
  int           (*control_proc)(
#if NeedNestedPrototypes
    struct _LocalDeviceRec* /*local*/,
    xDeviceCtl* /* control */
#endif
    );
  void          (*close_proc)(
#if NeedNestedPrototypes
    struct _LocalDeviceRec* /*local*/
#endif
    );
  int           (*switch_mode)(
#if NeedNestedPrototypes
    ClientPtr /*client*/,
    DeviceIntPtr /*dev*/,
    int /*mode*/
#endif
    );
    int			fd;
    Atom		atom;
    DeviceIntPtr	dev;
    pointer		private;
    int			private_flags;
    pointer		motion_history;
    ValuatorMotionProcPtr motion_history_proc;
    unsigned int	history_size;	/* only for configuration purpose */
    unsigned int	first;
    unsigned int	last;
    char		*type_name;
    IntegerFeedbackPtr	always_core_feedback;
} LocalDeviceRec, *LocalDevicePtr;

typedef struct _DeviceAssocRec 
{
  char                  *config_section_name;
  LocalDevicePtr        (*device_allocate)(
#if NeedNestedPrototypes
    void
#endif
);
} DeviceAssocRec, *DeviceAssocPtr;

extern	int		DeviceKeyPress;
extern	int		DeviceKeyRelease;
extern	int		DeviceButtonPress;
extern	int		DeviceButtonRelease;
extern	int		DeviceMotionNotify;
extern	int		DeviceValuator;
extern	int		ProximityIn;
extern	int		ProximityOut;

extern int
xf86IsCorePointer(
#if NeedFunctionPrototypes
	      DeviceIntPtr /*dev*/
#endif
);

extern int
xf86IsCoreKeyboard(
#if NeedFunctionPrototypes
	       DeviceIntPtr /*dev*/
#endif
);

extern void
xf86AlwaysCore(
#if NeedFunctionPrototypes
	       LocalDevicePtr	/*local*/,
	       Bool		/*always*/
#endif
);

void
xf86configExtendedInputSection(
#ifdef NeedFunctionPrototypes
		LexPtr          /* val */
#endif
);

void
xf86AddDeviceAssoc(
#ifdef NeedFunctionPrototypes
		DeviceAssocPtr	/* assoc */
#endif
);

void
InitExtInput(
#ifdef NeedFunctionPrototypes
		void
#endif
);

Bool
xf86eqInit (
#ifdef NeedFunctionPrototypes
		DevicePtr       /* pKbd */,
		DevicePtr       /* pPtr */
#endif
);

void
xf86eqEnqueue (
#ifdef NeedFunctionPrototypes
		struct _xEvent * /*event */
#endif
);

void
xf86eqProcessInputEvents (
#ifdef NeedFunctionPrototypes
		void
#endif
);

void
xf86PostMotionEvent(
#if NeedVarargsPrototypes
		DeviceIntPtr	/*device*/,
		int		/*is_absolute*/,
		int		/*first_valuator*/,
		int		/*num_valuators*/,
		...
#endif		
);

void
xf86PostProximityEvent(
#if NeedVarargsPrototypes
		   DeviceIntPtr	/*device*/,
		   int		/*is_in*/,
		   int		/*first_valuator*/,
		   int		/*num_valuators*/,
		   ...
#endif
);

void
xf86PostButtonEvent(
#if NeedVarargsPrototypes
		DeviceIntPtr	/*device*/,
		int		/*is_absolute*/,
		int		/*button*/,
		int		/*is_down*/,
		int		/*first_valuator*/,
		int		/*num_valuators*/,
		...
#endif
);

void
xf86PostKeyEvent(
#if NeedVarargsPrototypes
		 DeviceIntPtr	device,
		 unsigned int	key_code,
		 int		is_down,
		 int		is_absolute,
		 int		first_valuator,
		 int		num_valuators,
		 ...
#endif
);

void
xf86AddDeviceAssoc(
#if NeedFunctionPrototypes
		DeviceAssocPtr	/*assoc*/
#endif
);

void
xf86MotionHistoryAllocate(
#if NeedFunctionPrototypes
		      LocalDevicePtr	local
#endif
);

int
xf86GetMotionEvents(
#if NeedFunctionPrototypes
		    DeviceIntPtr	dev,
		    xTimecoord		*buff,
		    unsigned long	start,
		    unsigned long	stop,
		    ScreenPtr		pScreen
#endif
);

void
xf86XinputFinalizeInit(
#if NeedFunctionPrototypes
		       DeviceIntPtr	dev
#endif
);

Bool
xf86CheckButton(
#if NeedFunctionPrototypes
		int	button,
		int	down
#endif
);

#endif /* _xf86Xinput_h */