exevents.h revision 9ace9065
1/************************************************************
2
3Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
4
5                        All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the name of the above listed
12copyright holder(s) not be used in advertising or publicity pertaining
13to distribution of the software without specific, written prior
14permission.
15
16THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
17TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
19LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
24********************************************************/
25
26/********************************************************************
27 * Interface of 'exevents.c'
28 */
29
30#ifndef EXEVENTS_H
31#define EXEVENTS_H
32
33#include <X11/extensions/XIproto.h>
34#include "inputstr.h"
35
36/***************************************************************
37 *              Interface available to drivers                 *
38 ***************************************************************/
39
40extern _X_EXPORT int InitProximityClassDeviceStruct(
41	DeviceIntPtr           /* dev */);
42
43extern _X_EXPORT void InitValuatorAxisStruct(
44	DeviceIntPtr           /* dev */,
45	int                    /* axnum */,
46	Atom                   /* label */,
47	int                    /* minval */,
48	int                    /* maxval */,
49	int                    /* resolution */,
50	int                    /* min_res */,
51	int                    /* max_res */,
52	int                    /* mode */);
53
54/* Input device properties */
55extern _X_EXPORT void XIDeleteAllDeviceProperties(
56        DeviceIntPtr            /* device */
57);
58
59extern _X_EXPORT int XIDeleteDeviceProperty(
60        DeviceIntPtr            /* device */,
61        Atom                    /* property */,
62        Bool                    /* fromClient */
63);
64
65extern _X_EXPORT int XIChangeDeviceProperty(
66        DeviceIntPtr            /* dev */,
67        Atom                    /* property */,
68        Atom                    /* type */,
69        int                     /* format*/,
70        int                     /* mode*/,
71        unsigned long           /* len*/,
72        const pointer           /* value*/,
73        Bool                    /* sendevent*/
74        );
75
76extern _X_EXPORT int XIGetDeviceProperty(
77        DeviceIntPtr            /* dev */,
78        Atom                    /* property */,
79        XIPropertyValuePtr*     /* value */
80);
81
82extern _X_EXPORT int XISetDevicePropertyDeletable(
83        DeviceIntPtr            /* dev */,
84        Atom                    /* property */,
85        Bool                    /* deletable */
86);
87
88extern _X_EXPORT long XIRegisterPropertyHandler(
89        DeviceIntPtr         dev,
90        int (*SetProperty) (DeviceIntPtr dev,
91                            Atom property,
92                            XIPropertyValuePtr prop,
93                            BOOL checkonly),
94        int (*GetProperty) (DeviceIntPtr dev,
95                            Atom property),
96        int (*DeleteProperty) (DeviceIntPtr dev,
97                               Atom property)
98);
99
100extern _X_EXPORT void XIUnregisterPropertyHandler(
101        DeviceIntPtr          dev,
102        long                  id
103);
104
105extern _X_EXPORT Atom XIGetKnownProperty(
106        char*                 name
107);
108
109extern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev);
110
111extern _X_EXPORT int XIPropToInt(
112        XIPropertyValuePtr val,
113        int *nelem_return,
114        int **buf_return
115);
116
117extern _X_EXPORT int XIPropToFloat(
118        XIPropertyValuePtr val,
119        int *nelem_return,
120        float **buf_return
121);
122
123/****************************************************************************
124 *                      End of driver interface                             *
125 ****************************************************************************/
126
127
128/**
129 * Attached to the devPrivates of each client. Specifies the version number as
130 * supported by the client.
131 */
132typedef struct _XIClientRec {
133        int major_version;
134        int minor_version;
135} XIClientRec, *XIClientPtr;
136
137
138typedef struct _GrabParameters {
139    int                 grabtype;               /* GRABTYPE_CORE, etc. */
140    unsigned int        ownerEvents;
141    unsigned int        this_device_mode;
142    unsigned int        other_devices_mode;
143    Window              grabWindow;
144    Window              confineTo;
145    Cursor              cursor;
146    unsigned int        modifiers;
147} GrabParameters;
148
149
150extern int
151UpdateDeviceState (
152	DeviceIntPtr           /* device */,
153	DeviceEvent*           /*  xE    */);
154
155extern void
156ProcessOtherEvent (
157	InternalEvent*         /* ev */,
158	DeviceIntPtr           /* other */);
159
160extern void
161DeviceFocusEvent(
162	DeviceIntPtr           /* dev */,
163	int                    /* type */,
164	int                    /* mode */,
165	int                    /* detail */,
166	WindowPtr              /* pWin */);
167
168extern int
169CheckGrabValues(
170        ClientPtr              /* client */,
171        GrabParameters*        /* param */);
172
173extern int
174GrabButton(
175	ClientPtr              /* client */,
176	DeviceIntPtr           /* dev */,
177	DeviceIntPtr           /* modifier_device */,
178	int                    /* button */,
179        GrabParameters*        /* param */,
180        GrabType               /* grabtype */,
181	GrabMask*              /* eventMask */);
182
183extern int
184GrabKey(
185	ClientPtr              /* client */,
186	DeviceIntPtr           /* dev */,
187	DeviceIntPtr           /* modifier_device */,
188	int                    /* key */,
189        GrabParameters*        /* param */,
190        GrabType               /* grabtype */,
191	GrabMask*              /* eventMask */);
192
193extern int
194GrabWindow(
195	ClientPtr              /* client */,
196	DeviceIntPtr           /* dev */,
197	int                    /* type */,
198	GrabParameters*        /* param */,
199	GrabMask*              /* eventMask */);
200
201extern int
202SelectForWindow(
203	DeviceIntPtr           /* dev */,
204	WindowPtr              /* pWin */,
205	ClientPtr              /* client */,
206	Mask                   /* mask */,
207	Mask                   /* exclusivemasks */);
208
209extern int
210AddExtensionClient (
211	WindowPtr              /* pWin */,
212	ClientPtr              /* client */,
213	Mask                   /* mask */,
214	int                    /* mskidx */);
215
216extern void
217RecalculateDeviceDeliverableEvents(
218	WindowPtr              /* pWin */);
219
220extern int
221InputClientGone(
222	WindowPtr              /* pWin */,
223	XID                    /* id */);
224
225extern int
226SendEvent (
227	ClientPtr              /* client */,
228	DeviceIntPtr           /* d */,
229	Window                 /* dest */,
230	Bool                   /* propagate */,
231	xEvent *               /* ev */,
232	Mask                   /* mask */,
233	int                    /* count */);
234
235extern int
236SetButtonMapping (
237	ClientPtr              /* client */,
238	DeviceIntPtr           /* dev */,
239	int                    /* nElts */,
240	BYTE *                 /* map */);
241
242extern int
243ChangeKeyMapping(
244	ClientPtr              /* client */,
245	DeviceIntPtr           /* dev */,
246	unsigned               /* len */,
247	int                    /* type */,
248	KeyCode                /* firstKeyCode */,
249	CARD8                  /* keyCodes */,
250	CARD8                  /* keySymsPerKeyCode */,
251	KeySym *               /* map */);
252
253extern void
254DeleteWindowFromAnyExtEvents(
255	WindowPtr              /* pWin */,
256	Bool                   /* freeResources */);
257
258extern int
259MaybeSendDeviceMotionNotifyHint (
260	deviceKeyButtonPointer * /* pEvents */,
261	Mask                   /* mask */);
262
263extern void
264CheckDeviceGrabAndHintWindow (
265	WindowPtr              /* pWin */,
266	int                    /* type */,
267	deviceKeyButtonPointer * /* xE */,
268	GrabPtr                /* grab */,
269	ClientPtr              /* client */,
270	Mask                   /* deliveryMask */);
271
272extern void
273MaybeStopDeviceHint(
274	DeviceIntPtr           /* dev */,
275	ClientPtr              /* client */);
276
277extern int
278DeviceEventSuppressForWindow(
279	WindowPtr              /* pWin */,
280	ClientPtr              /* client */,
281	Mask                   /* mask */,
282	int                    /* maskndx */);
283
284extern void
285SendEventToAllWindows(
286        DeviceIntPtr           /* dev */,
287        Mask                   /* mask */,
288        xEvent *               /* ev */,
289        int                    /* count */);
290
291extern _X_HIDDEN void XI2EventSwap(
292        xGenericEvent  *              /* from */,
293        xGenericEvent  *              /* to */);
294
295/* For an event such as MappingNotify which affects client interpretation
296 * of input events sent by device dev, should we notify the client, or
297 * would it merely be irrelevant and confusing? */
298extern int
299XIShouldNotify(ClientPtr client, DeviceIntPtr dev);
300
301extern void
302XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master,
303                         DeviceChangedEvent *dce);
304
305extern int
306XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
307                           unsigned int len, unsigned char* mask);
308
309extern int
310XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
311
312#endif /* EXEVENTS_H */
313