1706f2543Smrg/************************************************************
2706f2543Smrg
3706f2543SmrgCopyright 1996 by Thomas E. Dickey <dickey@clark.net>
4706f2543Smrg
5706f2543Smrg                        All Rights Reserved
6706f2543Smrg
7706f2543SmrgPermission to use, copy, modify, and distribute this software and its
8706f2543Smrgdocumentation for any purpose and without fee is hereby granted,
9706f2543Smrgprovided that the above copyright notice appear in all copies and that
10706f2543Smrgboth that copyright notice and this permission notice appear in
11706f2543Smrgsupporting documentation, and that the name of the above listed
12706f2543Smrgcopyright holder(s) not be used in advertising or publicity pertaining
13706f2543Smrgto distribution of the software without specific, written prior
14706f2543Smrgpermission.
15706f2543Smrg
16706f2543SmrgTHE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
17706f2543SmrgTO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18706f2543SmrgAND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
19706f2543SmrgLIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20706f2543SmrgWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21706f2543SmrgACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22706f2543SmrgOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23706f2543Smrg
24706f2543Smrg********************************************************/
25706f2543Smrg
26706f2543Smrg/********************************************************************
27706f2543Smrg * Interface of 'exevents.c'
28706f2543Smrg */
29706f2543Smrg
30706f2543Smrg#ifndef EXEVENTS_H
31706f2543Smrg#define EXEVENTS_H
32706f2543Smrg
33706f2543Smrg#include <X11/extensions/XIproto.h>
34706f2543Smrg#include "inputstr.h"
35706f2543Smrg
36706f2543Smrg/***************************************************************
37706f2543Smrg *              Interface available to drivers                 *
38706f2543Smrg ***************************************************************/
39706f2543Smrg
40706f2543Smrgextern _X_EXPORT int InitProximityClassDeviceStruct(
41706f2543Smrg	DeviceIntPtr           /* dev */);
42706f2543Smrg
43706f2543Smrgextern _X_EXPORT void InitValuatorAxisStruct(
44706f2543Smrg	DeviceIntPtr           /* dev */,
45706f2543Smrg	int                    /* axnum */,
46706f2543Smrg	Atom                   /* label */,
47706f2543Smrg	int                    /* minval */,
48706f2543Smrg	int                    /* maxval */,
49706f2543Smrg	int                    /* resolution */,
50706f2543Smrg	int                    /* min_res */,
51706f2543Smrg	int                    /* max_res */,
52706f2543Smrg	int                    /* mode */);
53706f2543Smrg
54706f2543Smrg/* Input device properties */
55706f2543Smrgextern _X_EXPORT void XIDeleteAllDeviceProperties(
56706f2543Smrg        DeviceIntPtr            /* device */
57706f2543Smrg);
58706f2543Smrg
59706f2543Smrgextern _X_EXPORT int XIDeleteDeviceProperty(
60706f2543Smrg        DeviceIntPtr            /* device */,
61706f2543Smrg        Atom                    /* property */,
62706f2543Smrg        Bool                    /* fromClient */
63706f2543Smrg);
64706f2543Smrg
65706f2543Smrgextern _X_EXPORT int XIChangeDeviceProperty(
66706f2543Smrg        DeviceIntPtr            /* dev */,
67706f2543Smrg        Atom                    /* property */,
68706f2543Smrg        Atom                    /* type */,
69706f2543Smrg        int                     /* format*/,
70706f2543Smrg        int                     /* mode*/,
71706f2543Smrg        unsigned long           /* len*/,
72706f2543Smrg        const pointer           /* value*/,
73706f2543Smrg        Bool                    /* sendevent*/
74706f2543Smrg        );
75706f2543Smrg
76706f2543Smrgextern _X_EXPORT int XIGetDeviceProperty(
77706f2543Smrg        DeviceIntPtr            /* dev */,
78706f2543Smrg        Atom                    /* property */,
79706f2543Smrg        XIPropertyValuePtr*     /* value */
80706f2543Smrg);
81706f2543Smrg
82706f2543Smrgextern _X_EXPORT int XISetDevicePropertyDeletable(
83706f2543Smrg        DeviceIntPtr            /* dev */,
84706f2543Smrg        Atom                    /* property */,
85706f2543Smrg        Bool                    /* deletable */
86706f2543Smrg);
87706f2543Smrg
88706f2543Smrgextern _X_EXPORT long XIRegisterPropertyHandler(
89706f2543Smrg        DeviceIntPtr         dev,
90706f2543Smrg        int (*SetProperty) (DeviceIntPtr dev,
91706f2543Smrg                            Atom property,
92706f2543Smrg                            XIPropertyValuePtr prop,
93706f2543Smrg                            BOOL checkonly),
94706f2543Smrg        int (*GetProperty) (DeviceIntPtr dev,
95706f2543Smrg                            Atom property),
96706f2543Smrg        int (*DeleteProperty) (DeviceIntPtr dev,
97706f2543Smrg                               Atom property)
98706f2543Smrg);
99706f2543Smrg
100706f2543Smrgextern _X_EXPORT void XIUnregisterPropertyHandler(
101706f2543Smrg        DeviceIntPtr          dev,
102706f2543Smrg        long                  id
103706f2543Smrg);
104706f2543Smrg
105706f2543Smrgextern _X_EXPORT Atom XIGetKnownProperty(
106706f2543Smrg        char*                 name
107706f2543Smrg);
108706f2543Smrg
109706f2543Smrgextern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev);
110706f2543Smrg
111706f2543Smrgextern _X_EXPORT int XIPropToInt(
112706f2543Smrg        XIPropertyValuePtr val,
113706f2543Smrg        int *nelem_return,
114706f2543Smrg        int **buf_return
115706f2543Smrg);
116706f2543Smrg
117706f2543Smrgextern _X_EXPORT int XIPropToFloat(
118706f2543Smrg        XIPropertyValuePtr val,
119706f2543Smrg        int *nelem_return,
120706f2543Smrg        float **buf_return
121706f2543Smrg);
122706f2543Smrg
123706f2543Smrg/****************************************************************************
124706f2543Smrg *                      End of driver interface                             *
125706f2543Smrg ****************************************************************************/
126706f2543Smrg
127706f2543Smrg
128706f2543Smrg/**
129706f2543Smrg * Attached to the devPrivates of each client. Specifies the version number as
130706f2543Smrg * supported by the client.
131706f2543Smrg */
132706f2543Smrgtypedef struct _XIClientRec {
133706f2543Smrg        int major_version;
134706f2543Smrg        int minor_version;
135706f2543Smrg} XIClientRec, *XIClientPtr;
136706f2543Smrg
137706f2543Smrg
138706f2543Smrgtypedef struct _GrabParameters {
139706f2543Smrg    int                 grabtype;               /* GRABTYPE_CORE, etc. */
140706f2543Smrg    unsigned int        ownerEvents;
141706f2543Smrg    unsigned int        this_device_mode;
142706f2543Smrg    unsigned int        other_devices_mode;
143706f2543Smrg    Window              grabWindow;
144706f2543Smrg    Window              confineTo;
145706f2543Smrg    Cursor              cursor;
146706f2543Smrg    unsigned int        modifiers;
147706f2543Smrg} GrabParameters;
148706f2543Smrg
149706f2543Smrg
150706f2543Smrgextern int
151706f2543SmrgUpdateDeviceState (
152706f2543Smrg	DeviceIntPtr           /* device */,
153706f2543Smrg	DeviceEvent*           /*  xE    */);
154706f2543Smrg
155706f2543Smrgextern void
156706f2543SmrgProcessOtherEvent (
157706f2543Smrg	InternalEvent*         /* ev */,
158706f2543Smrg	DeviceIntPtr           /* other */);
159706f2543Smrg
160706f2543Smrgextern void
161706f2543SmrgDeviceFocusEvent(
162706f2543Smrg	DeviceIntPtr           /* dev */,
163706f2543Smrg	int                    /* type */,
164706f2543Smrg	int                    /* mode */,
165706f2543Smrg	int                    /* detail */,
166706f2543Smrg	WindowPtr              /* pWin */);
167706f2543Smrg
168706f2543Smrgextern int
169706f2543SmrgCheckGrabValues(
170706f2543Smrg        ClientPtr              /* client */,
171706f2543Smrg        GrabParameters*        /* param */);
172706f2543Smrg
173706f2543Smrgextern int
174706f2543SmrgGrabButton(
175706f2543Smrg	ClientPtr              /* client */,
176706f2543Smrg	DeviceIntPtr           /* dev */,
177706f2543Smrg	DeviceIntPtr           /* modifier_device */,
178706f2543Smrg	int                    /* button */,
179706f2543Smrg        GrabParameters*        /* param */,
180706f2543Smrg        GrabType               /* grabtype */,
181706f2543Smrg	GrabMask*              /* eventMask */);
182706f2543Smrg
183706f2543Smrgextern int
184706f2543SmrgGrabKey(
185706f2543Smrg	ClientPtr              /* client */,
186706f2543Smrg	DeviceIntPtr           /* dev */,
187706f2543Smrg	DeviceIntPtr           /* modifier_device */,
188706f2543Smrg	int                    /* key */,
189706f2543Smrg        GrabParameters*        /* param */,
190706f2543Smrg        GrabType               /* grabtype */,
191706f2543Smrg	GrabMask*              /* eventMask */);
192706f2543Smrg
193706f2543Smrgextern int
194706f2543SmrgGrabWindow(
195706f2543Smrg	ClientPtr              /* client */,
196706f2543Smrg	DeviceIntPtr           /* dev */,
197706f2543Smrg	int                    /* type */,
198706f2543Smrg	GrabParameters*        /* param */,
199706f2543Smrg	GrabMask*              /* eventMask */);
200706f2543Smrg
201706f2543Smrgextern int
202706f2543SmrgSelectForWindow(
203706f2543Smrg	DeviceIntPtr           /* dev */,
204706f2543Smrg	WindowPtr              /* pWin */,
205706f2543Smrg	ClientPtr              /* client */,
206706f2543Smrg	Mask                   /* mask */,
207706f2543Smrg	Mask                   /* exclusivemasks */);
208706f2543Smrg
209706f2543Smrgextern int
210706f2543SmrgAddExtensionClient (
211706f2543Smrg	WindowPtr              /* pWin */,
212706f2543Smrg	ClientPtr              /* client */,
213706f2543Smrg	Mask                   /* mask */,
214706f2543Smrg	int                    /* mskidx */);
215706f2543Smrg
216706f2543Smrgextern void
217706f2543SmrgRecalculateDeviceDeliverableEvents(
218706f2543Smrg	WindowPtr              /* pWin */);
219706f2543Smrg
220706f2543Smrgextern int
221706f2543SmrgInputClientGone(
222706f2543Smrg	WindowPtr              /* pWin */,
223706f2543Smrg	XID                    /* id */);
224706f2543Smrg
225706f2543Smrgextern int
226706f2543SmrgSendEvent (
227706f2543Smrg	ClientPtr              /* client */,
228706f2543Smrg	DeviceIntPtr           /* d */,
229706f2543Smrg	Window                 /* dest */,
230706f2543Smrg	Bool                   /* propagate */,
231706f2543Smrg	xEvent *               /* ev */,
232706f2543Smrg	Mask                   /* mask */,
233706f2543Smrg	int                    /* count */);
234706f2543Smrg
235706f2543Smrgextern int
236706f2543SmrgSetButtonMapping (
237706f2543Smrg	ClientPtr              /* client */,
238706f2543Smrg	DeviceIntPtr           /* dev */,
239706f2543Smrg	int                    /* nElts */,
240706f2543Smrg	BYTE *                 /* map */);
241706f2543Smrg
242706f2543Smrgextern int
243706f2543SmrgChangeKeyMapping(
244706f2543Smrg	ClientPtr              /* client */,
245706f2543Smrg	DeviceIntPtr           /* dev */,
246706f2543Smrg	unsigned               /* len */,
247706f2543Smrg	int                    /* type */,
248706f2543Smrg	KeyCode                /* firstKeyCode */,
249706f2543Smrg	CARD8                  /* keyCodes */,
250706f2543Smrg	CARD8                  /* keySymsPerKeyCode */,
251706f2543Smrg	KeySym *               /* map */);
252706f2543Smrg
253706f2543Smrgextern void
254706f2543SmrgDeleteWindowFromAnyExtEvents(
255706f2543Smrg	WindowPtr              /* pWin */,
256706f2543Smrg	Bool                   /* freeResources */);
257706f2543Smrg
258706f2543Smrgextern int
259706f2543SmrgMaybeSendDeviceMotionNotifyHint (
260706f2543Smrg	deviceKeyButtonPointer * /* pEvents */,
261706f2543Smrg	Mask                   /* mask */);
262706f2543Smrg
263706f2543Smrgextern void
264706f2543SmrgCheckDeviceGrabAndHintWindow (
265706f2543Smrg	WindowPtr              /* pWin */,
266706f2543Smrg	int                    /* type */,
267706f2543Smrg	deviceKeyButtonPointer * /* xE */,
268706f2543Smrg	GrabPtr                /* grab */,
269706f2543Smrg	ClientPtr              /* client */,
270706f2543Smrg	Mask                   /* deliveryMask */);
271706f2543Smrg
272706f2543Smrgextern void
273706f2543SmrgMaybeStopDeviceHint(
274706f2543Smrg	DeviceIntPtr           /* dev */,
275706f2543Smrg	ClientPtr              /* client */);
276706f2543Smrg
277706f2543Smrgextern int
278706f2543SmrgDeviceEventSuppressForWindow(
279706f2543Smrg	WindowPtr              /* pWin */,
280706f2543Smrg	ClientPtr              /* client */,
281706f2543Smrg	Mask                   /* mask */,
282706f2543Smrg	int                    /* maskndx */);
283706f2543Smrg
284706f2543Smrgextern void
285706f2543SmrgSendEventToAllWindows(
286706f2543Smrg        DeviceIntPtr           /* dev */,
287706f2543Smrg        Mask                   /* mask */,
288706f2543Smrg        xEvent *               /* ev */,
289706f2543Smrg        int                    /* count */);
290706f2543Smrg
291706f2543Smrgextern _X_HIDDEN void XI2EventSwap(
292706f2543Smrg        xGenericEvent  *              /* from */,
293706f2543Smrg        xGenericEvent  *              /* to */);
294706f2543Smrg
295706f2543Smrg/* For an event such as MappingNotify which affects client interpretation
296706f2543Smrg * of input events sent by device dev, should we notify the client, or
297706f2543Smrg * would it merely be irrelevant and confusing? */
298706f2543Smrgextern int
299706f2543SmrgXIShouldNotify(ClientPtr client, DeviceIntPtr dev);
300706f2543Smrg
301706f2543Smrgextern void
302706f2543SmrgXISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master,
303706f2543Smrg                         DeviceChangedEvent *dce);
304706f2543Smrg
305706f2543Smrgextern int
306706f2543SmrgXISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
307706f2543Smrg                           unsigned int len, unsigned char* mask);
308706f2543Smrg
309706f2543Smrgextern int
310706f2543SmrgXICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
311706f2543Smrg
312706f2543Smrg#endif /* EXEVENTS_H */
313