105b261ecSmrg/************************************************************
205b261ecSmrg
305b261ecSmrgCopyright 1996 by Thomas E. Dickey <dickey@clark.net>
405b261ecSmrg
505b261ecSmrg                        All Rights Reserved
605b261ecSmrg
705b261ecSmrgPermission to use, copy, modify, and distribute this software and its
805b261ecSmrgdocumentation for any purpose and without fee is hereby granted,
905b261ecSmrgprovided that the above copyright notice appear in all copies and that
1005b261ecSmrgboth that copyright notice and this permission notice appear in
1105b261ecSmrgsupporting documentation, and that the name of the above listed
1205b261ecSmrgcopyright holder(s) not be used in advertising or publicity pertaining
1305b261ecSmrgto distribution of the software without specific, written prior
1405b261ecSmrgpermission.
1505b261ecSmrg
1605b261ecSmrgTHE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
1705b261ecSmrgTO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1805b261ecSmrgAND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
1905b261ecSmrgLIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2005b261ecSmrgWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
2105b261ecSmrgACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
2205b261ecSmrgOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2305b261ecSmrg
2405b261ecSmrg********************************************************/
2505b261ecSmrg
2605b261ecSmrg/********************************************************************
2705b261ecSmrg * Interface of 'exevents.c'
2805b261ecSmrg */
2905b261ecSmrg
3005b261ecSmrg#ifndef EXEVENTS_H
3105b261ecSmrg#define EXEVENTS_H
3205b261ecSmrg
3305b261ecSmrg#include <X11/extensions/XIproto.h>
346747b715Smrg#include "inputstr.h"
356747b715Smrg
366747b715Smrg/***************************************************************
376747b715Smrg *              Interface available to drivers                 *
386747b715Smrg ***************************************************************/
396747b715Smrg
4035c4bbdfSmrg/**
4135c4bbdfSmrg * Scroll flags for ::SetScrollValuator.
4235c4bbdfSmrg */
4335c4bbdfSmrgenum ScrollFlags {
4435c4bbdfSmrg    SCROLL_FLAG_NONE = 0,
4535c4bbdfSmrg    /**
4635c4bbdfSmrg     * Do not emulate legacy button events for valuator events on this axis.
4735c4bbdfSmrg     */
4835c4bbdfSmrg    SCROLL_FLAG_DONT_EMULATE = (1 << 1),
4935c4bbdfSmrg    /**
5035c4bbdfSmrg     * This axis is the preferred axis for valuator emulation for this axis'
5135c4bbdfSmrg     * scroll type.
5235c4bbdfSmrg     */
5335c4bbdfSmrg    SCROLL_FLAG_PREFERRED = (1 << 2)
5435c4bbdfSmrg};
5535c4bbdfSmrg
5635c4bbdfSmrgextern _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr /* dev */ );
5735c4bbdfSmrg
5835c4bbdfSmrgextern _X_EXPORT Bool InitValuatorAxisStruct(DeviceIntPtr /* dev */ ,
5935c4bbdfSmrg                                             int /* axnum */ ,
6035c4bbdfSmrg                                             Atom /* label */ ,
6135c4bbdfSmrg                                             int /* minval */ ,
6235c4bbdfSmrg                                             int /* maxval */ ,
6335c4bbdfSmrg                                             int /* resolution */ ,
6435c4bbdfSmrg                                             int /* min_res */ ,
6535c4bbdfSmrg                                             int /* max_res */ ,
6635c4bbdfSmrg                                             int /* mode */ );
6735c4bbdfSmrg
6835c4bbdfSmrgextern _X_EXPORT Bool SetScrollValuator(DeviceIntPtr /* dev */ ,
6935c4bbdfSmrg                                        int /* axnum */ ,
7035c4bbdfSmrg                                        enum ScrollType /* type */ ,
7135c4bbdfSmrg                                        double /* increment */ ,
7235c4bbdfSmrg                                        int /* flags */ );
736747b715Smrg
746747b715Smrg/* Input device properties */
7535c4bbdfSmrgextern _X_EXPORT void XIDeleteAllDeviceProperties(DeviceIntPtr  /* device */
7635c4bbdfSmrg    );
7735c4bbdfSmrg
7835c4bbdfSmrgextern _X_EXPORT int XIDeleteDeviceProperty(DeviceIntPtr /* device */ ,
7935c4bbdfSmrg                                            Atom /* property */ ,
8035c4bbdfSmrg                                            Bool        /* fromClient */
8135c4bbdfSmrg    );
8235c4bbdfSmrg
8335c4bbdfSmrgextern _X_EXPORT int XIChangeDeviceProperty(DeviceIntPtr /* dev */ ,
8435c4bbdfSmrg                                            Atom /* property */ ,
8535c4bbdfSmrg                                            Atom /* type */ ,
8635c4bbdfSmrg                                            int /* format */ ,
8735c4bbdfSmrg                                            int /* mode */ ,
8835c4bbdfSmrg                                            unsigned long /* len */ ,
8935c4bbdfSmrg                                            const void * /* value */ ,
9035c4bbdfSmrg                                            Bool        /* sendevent */
9135c4bbdfSmrg    );
9235c4bbdfSmrg
9335c4bbdfSmrgextern _X_EXPORT int XIGetDeviceProperty(DeviceIntPtr /* dev */ ,
9435c4bbdfSmrg                                         Atom /* property */ ,
9535c4bbdfSmrg                                         XIPropertyValuePtr *   /* value */
9635c4bbdfSmrg    );
9735c4bbdfSmrg
9835c4bbdfSmrgextern _X_EXPORT int XISetDevicePropertyDeletable(DeviceIntPtr /* dev */ ,
9935c4bbdfSmrg                                                  Atom /* property */ ,
10035c4bbdfSmrg                                                  Bool  /* deletable */
10135c4bbdfSmrg    );
10235c4bbdfSmrg
10335c4bbdfSmrgextern _X_EXPORT long XIRegisterPropertyHandler(DeviceIntPtr dev,
10435c4bbdfSmrg                                                int (*SetProperty) (DeviceIntPtr
10535c4bbdfSmrg                                                                    dev,
10635c4bbdfSmrg                                                                    Atom
10735c4bbdfSmrg                                                                    property,
10835c4bbdfSmrg                                                                    XIPropertyValuePtr
10935c4bbdfSmrg                                                                    prop,
11035c4bbdfSmrg                                                                    BOOL
11135c4bbdfSmrg                                                                    checkonly),
11235c4bbdfSmrg                                                int (*GetProperty) (DeviceIntPtr
11335c4bbdfSmrg                                                                    dev,
11435c4bbdfSmrg                                                                    Atom
11535c4bbdfSmrg                                                                    property),
11635c4bbdfSmrg                                                int (*DeleteProperty)
11735c4bbdfSmrg                                                (DeviceIntPtr dev,
11835c4bbdfSmrg                                                 Atom property)
11935c4bbdfSmrg    );
12035c4bbdfSmrg
12135c4bbdfSmrgextern _X_EXPORT void XIUnregisterPropertyHandler(DeviceIntPtr dev, long id);
12235c4bbdfSmrg
12335c4bbdfSmrgextern _X_EXPORT Atom XIGetKnownProperty(const char *name);
1246747b715Smrg
1256747b715Smrgextern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev);
1266747b715Smrg
12735c4bbdfSmrgextern _X_EXPORT int XIPropToInt(XIPropertyValuePtr val,
12835c4bbdfSmrg                                 int *nelem_return, int **buf_return);
1296747b715Smrg
13035c4bbdfSmrgextern _X_EXPORT int XIPropToFloat(XIPropertyValuePtr val,
13135c4bbdfSmrg                                   int *nelem_return, float **buf_return);
1326747b715Smrg
1336747b715Smrg/****************************************************************************
1346747b715Smrg *                      End of driver interface                             *
1356747b715Smrg ****************************************************************************/
1366747b715Smrg
1374642e01fSmrg/**
1384642e01fSmrg * Attached to the devPrivates of each client. Specifies the version number as
1394642e01fSmrg * supported by the client.
1404642e01fSmrg */
1414642e01fSmrgtypedef struct _XIClientRec {
14235c4bbdfSmrg    int major_version;
14335c4bbdfSmrg    int minor_version;
1444642e01fSmrg} XIClientRec, *XIClientPtr;
1454642e01fSmrg
1466747b715Smrgtypedef struct _GrabParameters {
14735c4bbdfSmrg    int grabtype;               /* CORE, etc. */
14835c4bbdfSmrg    unsigned int ownerEvents;
14935c4bbdfSmrg    unsigned int this_device_mode;
15035c4bbdfSmrg    unsigned int other_devices_mode;
15135c4bbdfSmrg    Window grabWindow;
15235c4bbdfSmrg    Window confineTo;
15335c4bbdfSmrg    Cursor cursor;
15435c4bbdfSmrg    unsigned int modifiers;
1556747b715Smrg} GrabParameters;
1566747b715Smrg
1574642e01fSmrgextern int
15835c4bbdfSmrg UpdateDeviceState(DeviceIntPtr /* device */ ,
15935c4bbdfSmrg                   DeviceEvent * /*  xE    */ );
1604642e01fSmrg
1616747b715Smrgextern void
16235c4bbdfSmrg ProcessOtherEvent(InternalEvent * /* ev */ ,
16335c4bbdfSmrg                   DeviceIntPtr /* other */ );
16405b261ecSmrg
16535c4bbdfSmrgextern int
16635c4bbdfSmrg CheckGrabValues(ClientPtr /* client */ ,
16735c4bbdfSmrg                 GrabParameters * /* param */ );
16805b261ecSmrg
1696747b715Smrgextern int
17035c4bbdfSmrg GrabButton(ClientPtr /* client */ ,
17135c4bbdfSmrg            DeviceIntPtr /* dev */ ,
17235c4bbdfSmrg            DeviceIntPtr /* modifier_device */ ,
17335c4bbdfSmrg            int /* button */ ,
17435c4bbdfSmrg            GrabParameters * /* param */ ,
17535c4bbdfSmrg            enum InputLevel /* grabtype */ ,
17635c4bbdfSmrg            GrabMask * /* eventMask */ );
1776747b715Smrg
1786747b715Smrgextern int
17935c4bbdfSmrg GrabKey(ClientPtr /* client */ ,
18035c4bbdfSmrg         DeviceIntPtr /* dev */ ,
18135c4bbdfSmrg         DeviceIntPtr /* modifier_device */ ,
18235c4bbdfSmrg         int /* key */ ,
18335c4bbdfSmrg         GrabParameters * /* param */ ,
18435c4bbdfSmrg         enum InputLevel /* grabtype */ ,
18535c4bbdfSmrg         GrabMask * /* eventMask */ );
1866747b715Smrg
1876747b715Smrgextern int
18835c4bbdfSmrg GrabWindow(ClientPtr /* client */ ,
18935c4bbdfSmrg            DeviceIntPtr /* dev */ ,
19035c4bbdfSmrg            int /* type */ ,
19135c4bbdfSmrg            GrabParameters * /* param */ ,
19235c4bbdfSmrg            GrabMask * /* eventMask */ );
1936747b715Smrg
1946747b715Smrgextern int
195ed6184dfSmrg GrabTouchOrGesture(ClientPtr /* client */ ,
196ed6184dfSmrg                    DeviceIntPtr /* dev */ ,
197ed6184dfSmrg                    DeviceIntPtr /* mod_dev */ ,
198ed6184dfSmrg                    int /* type */ ,
199ed6184dfSmrg                    GrabParameters * /* param */ ,
200ed6184dfSmrg                    GrabMask * /* eventMask */ );
20105b261ecSmrg
2026747b715Smrgextern int
20335c4bbdfSmrg SelectForWindow(DeviceIntPtr /* dev */ ,
20435c4bbdfSmrg                 WindowPtr /* pWin */ ,
20535c4bbdfSmrg                 ClientPtr /* client */ ,
20635c4bbdfSmrg                 Mask /* mask */ ,
20735c4bbdfSmrg                 Mask /* exclusivemasks */ );
20805b261ecSmrg
2096747b715Smrgextern int
21035c4bbdfSmrg AddExtensionClient(WindowPtr /* pWin */ ,
21135c4bbdfSmrg                    ClientPtr /* client */ ,
21235c4bbdfSmrg                    Mask /* mask */ ,
21335c4bbdfSmrg                    int /* mskidx */ );
21405b261ecSmrg
2156747b715Smrgextern void
21635c4bbdfSmrg RecalculateDeviceDeliverableEvents(WindowPtr /* pWin */ );
21705b261ecSmrg
2186747b715Smrgextern int
21935c4bbdfSmrg InputClientGone(WindowPtr /* pWin */ ,
22035c4bbdfSmrg                 XID /* id */ );
22135c4bbdfSmrg
22235c4bbdfSmrgextern void
22335c4bbdfSmrg WindowGone(WindowPtr /* win */ );
22405b261ecSmrg
2256747b715Smrgextern int
22635c4bbdfSmrg SendEvent(ClientPtr /* client */ ,
22735c4bbdfSmrg           DeviceIntPtr /* d */ ,
22835c4bbdfSmrg           Window /* dest */ ,
22935c4bbdfSmrg           Bool /* propagate */ ,
23035c4bbdfSmrg           xEvent * /* ev */ ,
23135c4bbdfSmrg           Mask /* mask */ ,
23235c4bbdfSmrg           int /* count */ );
23305b261ecSmrg
2346747b715Smrgextern int
23535c4bbdfSmrg SetButtonMapping(ClientPtr /* client */ ,
23635c4bbdfSmrg                  DeviceIntPtr /* dev */ ,
23735c4bbdfSmrg                  int /* nElts */ ,
23835c4bbdfSmrg                  BYTE * /* map */ );
23905b261ecSmrg
2406747b715Smrgextern int
24135c4bbdfSmrg ChangeKeyMapping(ClientPtr /* client */ ,
24235c4bbdfSmrg                  DeviceIntPtr /* dev */ ,
24335c4bbdfSmrg                  unsigned /* len */ ,
24435c4bbdfSmrg                  int /* type */ ,
24535c4bbdfSmrg                  KeyCode /* firstKeyCode */ ,
24635c4bbdfSmrg                  CARD8 /* keyCodes */ ,
24735c4bbdfSmrg                  CARD8 /* keySymsPerKeyCode */ ,
24835c4bbdfSmrg                  KeySym * /* map */ );
24905b261ecSmrg
2506747b715Smrgextern void
25135c4bbdfSmrg DeleteWindowFromAnyExtEvents(WindowPtr /* pWin */ ,
25235c4bbdfSmrg                              Bool /* freeResources */ );
25305b261ecSmrg
2546747b715Smrgextern int
25535c4bbdfSmrg MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * /* pEvents */ ,
25635c4bbdfSmrg                                 Mask /* mask */ );
25705b261ecSmrg
2586747b715Smrgextern void
25935c4bbdfSmrg CheckDeviceGrabAndHintWindow(WindowPtr /* pWin */ ,
26035c4bbdfSmrg                              int /* type */ ,
26135c4bbdfSmrg                              deviceKeyButtonPointer * /* xE */ ,
26235c4bbdfSmrg                              GrabPtr /* grab */ ,
26335c4bbdfSmrg                              ClientPtr /* client */ ,
26435c4bbdfSmrg                              Mask /* deliveryMask */ );
26505b261ecSmrg
2666747b715Smrgextern void
26735c4bbdfSmrg MaybeStopDeviceHint(DeviceIntPtr /* dev */ ,
26835c4bbdfSmrg                     ClientPtr /* client */ );
26905b261ecSmrg
2706747b715Smrgextern int
27135c4bbdfSmrg DeviceEventSuppressForWindow(WindowPtr /* pWin */ ,
27235c4bbdfSmrg                              ClientPtr /* client */ ,
27335c4bbdfSmrg                              Mask /* mask */ ,
27435c4bbdfSmrg                              int /* maskndx */ );
27505b261ecSmrg
2766747b715Smrgextern void
27735c4bbdfSmrg SendEventToAllWindows(DeviceIntPtr /* dev */ ,
27835c4bbdfSmrg                       Mask /* mask */ ,
27935c4bbdfSmrg                       xEvent * /* ev */ ,
28035c4bbdfSmrg                       int /* count */ );
28105b261ecSmrg
28235c4bbdfSmrgextern void
28335c4bbdfSmrg TouchRejected(DeviceIntPtr /* sourcedev */ ,
28435c4bbdfSmrg               TouchPointInfoPtr /* ti */ ,
28535c4bbdfSmrg               XID /* resource */ ,
28635c4bbdfSmrg               TouchOwnershipEvent * /* ev */ );
28735c4bbdfSmrg
28835c4bbdfSmrgextern _X_HIDDEN void XI2EventSwap(xGenericEvent * /* from */ ,
28935c4bbdfSmrg                                   xGenericEvent * /* to */ );
2904642e01fSmrg
2916747b715Smrg/* For an event such as MappingNotify which affects client interpretation
2926747b715Smrg * of input events sent by device dev, should we notify the client, or
2936747b715Smrg * would it merely be irrelevant and confusing? */
2946747b715Smrgextern int
29535c4bbdfSmrg XIShouldNotify(ClientPtr client, DeviceIntPtr dev);
2964642e01fSmrg
2976747b715Smrgextern void
29835c4bbdfSmrg XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce);
2994642e01fSmrg
3006747b715Smrgextern int
30135c4bbdfSmrg
3026747b715SmrgXISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
30335c4bbdfSmrg               unsigned int len, unsigned char *mask);
3044642e01fSmrg
3056747b715Smrgextern int
30635c4bbdfSmrg XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
3074642e01fSmrg
30835c4bbdfSmrg#endif                          /* EXEVENTS_H */
309