1 /* $XConsortium: XInput.h,v 1.22 94/04/17 20:11:13 rws Exp $ */
2 
3 /************************************************************
4 
5 Copyright (c) 1989  X Consortium
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
27 
28 Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California.
29 
30 			All Rights Reserved
31 
32 Permission to use, copy, modify, and distribute this software and its
33 documentation for any purpose and without fee is hereby granted,
34 provided that the above copyright notice appear in all copies and that
35 both that copyright notice and this permission notice appear in
36 supporting documentation, and that the name of Hewlett-Packard not be
37 used in advertising or publicity pertaining to distribution of the
38 software without specific, written prior permission.
39 
40 HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42 HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 SOFTWARE.
47 
48 ********************************************************/
49 
50 /* Definitions used by the library and client */
51 
52 #ifndef _XINPUT_H_
53 #define _XINPUT_H_
54 
55 #ifndef _XLIB_H_
56 #include <X11/Xlib.h>
57 #endif
58 
59 #ifndef _XI_H_
60 #include "XI.h"
61 #endif
62 
63 #define _deviceKeyPress		0
64 #define _deviceKeyRelease	1
65 
66 #define _deviceButtonPress	0
67 #define _deviceButtonRelease	1
68 
69 #define _deviceMotionNotify	0
70 
71 #define _deviceFocusIn		0
72 #define _deviceFocusOut		1
73 
74 #define _proximityIn		0
75 #define _proximityOut		1
76 
77 #define _deviceStateNotify	0
78 #define _deviceMappingNotify	1
79 #define _changeDeviceNotify	2
80 
81 #define FindTypeAndClass(d,type,_class,classid,offset) \
82     { int _i; XInputClassInfo *_ip; \
83     type = 0; _class = 0; \
84     for (_i=0, _ip= ((XDevice *) d)->classes; \
85 	 _i< ((XDevice *) d)->num_classes; \
86 	 _i++, _ip++) \
87 	if (_ip->input_class == classid) \
88 	    {type =  _ip->event_type_base + offset; \
89 	     _class =  ((XDevice *) d)->device_id << 8 | type;}}
90 
91 #define DeviceKeyPress(d,type,_class) \
92     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
93 
94 #define DeviceKeyRelease(d,type,_class) \
95     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
96 
97 #define DeviceButtonPress(d,type,_class) \
98     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
99 
100 #define DeviceButtonRelease(d,type,_class) \
101     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
102 
103 #define DeviceMotionNotify(d,type,_class) \
104     FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
105 
106 #define DeviceFocusIn(d,type,_class) \
107     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
108 
109 #define DeviceFocusOut(d,type,_class) \
110     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
111 
112 #define ProximityIn(d,type,_class) \
113     FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
114 
115 #define ProximityOut(d,type,_class) \
116     FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
117 
118 #define DeviceStateNotify(d,type,_class) \
119     FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
120 
121 #define DeviceMappingNotify(d,type,_class) \
122     FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
123 
124 #define ChangeDeviceNotify(d,type,_class) \
125     FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
126 
127 #define DevicePointerMotionHint(d,type,_class) \
128     { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
129 
130 #define DeviceButton1Motion(d,type,_class) \
131     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
132 
133 #define DeviceButton2Motion(d,type,_class) \
134     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
135 
136 #define DeviceButton3Motion(d,type,_class) \
137     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
138 
139 #define DeviceButton4Motion(d,type, _class) \
140     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
141 
142 #define DeviceButton5Motion(d,type,_class) \
143     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
144 
145 #define DeviceButtonMotion(d,type, _class) \
146     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
147 
148 #define DeviceOwnerGrabButton(d,type,_class) \
149     { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
150 
151 #define DeviceButtonPressGrab(d,type,_class) \
152     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
153 
154 #define NoExtensionEvent(d,type,_class) \
155     { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
156 
157 #define BadDevice(dpy,error) _xibaddevice(dpy, &error)
158 
159 #define BadClass(dpy,error) _xibadclass(dpy, &error)
160 
161 #define BadEvent(dpy,error) _xibadevent(dpy, &error)
162 
163 #define BadMode(dpy,error) _xibadmode(dpy, &error)
164 
165 #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
166 
167 /***************************************************************
168  *
169  * DeviceKey events.  These events are sent by input devices that
170  * support input class Keys.
171  * The location of the X pointer is reported in the coordinate
172  * fields of the x,y and x_root,y_root fields.
173  *
174  */
175 
176 typedef struct
177     {
178     int            type;         /* of event */
179     unsigned long  serial;       /* # of last request processed */
180     Bool           send_event;   /* true if from SendEvent request */
181     Display        *display;     /* Display the event was read from */
182     Window         window;       /* "event" window reported relative to */
183     XID            deviceid;
184     Window         root;         /* root window event occured on */
185     Window         subwindow;    /* child window */
186     Time           time;         /* milliseconds */
187     int            x, y;         /* x, y coordinates in event window */
188     int            x_root;       /* coordinates relative to root */
189     int            y_root;       /* coordinates relative to root */
190     unsigned int   state;        /* key or button mask */
191     unsigned int   keycode;      /* detail */
192     Bool           same_screen;  /* same screen flag */
193     unsigned int   device_state; /* device key or button mask */
194     unsigned char  axes_count;
195     unsigned char  first_axis;
196     int            axis_data[6];
197     } XDeviceKeyEvent;
198 
199 typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
200 typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
201 
202 /*******************************************************************
203  *
204  * DeviceButton events.  These events are sent by extension devices
205  * that support input class Buttons.
206  *
207  */
208 
209 typedef struct {
210     int           type;         /* of event */
211     unsigned long serial;       /* # of last request processed by server */
212     Bool          send_event;   /* true if from a SendEvent request */
213     Display       *display;     /* Display the event was read from */
214     Window        window;       /* "event" window reported relative to */
215     XID           deviceid;
216     Window        root;         /* root window that the event occured on */
217     Window        subwindow;    /* child window */
218     Time          time;         /* milliseconds */
219     int           x, y;         /* x, y coordinates in event window */
220     int           x_root;       /* coordinates relative to root */
221     int           y_root;       /* coordinates relative to root */
222     unsigned int  state;        /* key or button mask */
223     unsigned int  button;       /* detail */
224     Bool          same_screen;  /* same screen flag */
225     unsigned int  device_state; /* device key or button mask */
226     unsigned char axes_count;
227     unsigned char first_axis;
228     int           axis_data[6];
229     } XDeviceButtonEvent;
230 
231 typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
232 typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
233 
234 /*******************************************************************
235  *
236  * DeviceMotionNotify event.  These events are sent by extension devices
237  * that support input class Valuators.
238  *
239  */
240 
241 typedef struct
242     {
243     int           type;        /* of event */
244     unsigned long serial;      /* # of last request processed by server */
245     Bool          send_event;  /* true if from a SendEvent request */
246     Display       *display;    /* Display the event was read from */
247     Window        window;      /* "event" window reported relative to */
248     XID           deviceid;
249     Window        root;        /* root window that the event occured on */
250     Window        subwindow;   /* child window */
251     Time          time;        /* milliseconds */
252     int           x, y;        /* x, y coordinates in event window */
253     int           x_root;      /* coordinates relative to root */
254     int           y_root;      /* coordinates relative to root */
255     unsigned int  state;       /* key or button mask */
256     char          is_hint;     /* detail */
257     Bool          same_screen; /* same screen flag */
258     unsigned int  device_state; /* device key or button mask */
259     unsigned char axes_count;
260     unsigned char first_axis;
261     int           axis_data[6];
262     } XDeviceMotionEvent;
263 
264 /*******************************************************************
265  *
266  * DeviceFocusChange events.  These events are sent when the focus
267  * of an extension device that can be focused is changed.
268  *
269  */
270 
271 typedef struct
272     {
273     int           type;       /* of event */
274     unsigned long serial;     /* # of last request processed by server */
275     Bool          send_event; /* true if from a SendEvent request */
276     Display       *display;   /* Display the event was read from */
277     Window        window;     /* "event" window reported relative to */
278     XID           deviceid;
279     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
280     int           detail;
281 	/*
282 	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
283 	 * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
284 	 * NotifyPointerRoot, NotifyDetailNone
285 	 */
286     Time                time;
287     } XDeviceFocusChangeEvent;
288 
289 typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
290 typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
291 
292 /*******************************************************************
293  *
294  * ProximityNotify events.  These events are sent by those absolute
295  * positioning devices that are capable of generating proximity information.
296  *
297  */
298 
299 typedef struct
300     {
301     int             type;      /* ProximityIn or ProximityOut */
302     unsigned long   serial;    /* # of last request processed by server */
303     Bool            send_event; /* true if this came from a SendEvent request */
304     Display         *display;  /* Display the event was read from */
305     Window          window;
306     XID	            deviceid;
307     Window          root;
308     Window          subwindow;
309     Time            time;
310     int             x, y;
311     int             x_root, y_root;
312     unsigned int    state;
313     Bool            same_screen;
314     unsigned int    device_state; /* device key or button mask */
315     unsigned char   axes_count;
316     unsigned char   first_axis;
317     int             axis_data[6];
318     } XProximityNotifyEvent;
319 typedef XProximityNotifyEvent XProximityInEvent;
320 typedef XProximityNotifyEvent XProximityOutEvent;
321 
322 /*******************************************************************
323  *
324  * DeviceStateNotify events are generated on EnterWindow and FocusIn
325  * for those clients who have selected DeviceState.
326  *
327  */
328 
329 typedef struct
330     {
331 #if defined(__cplusplus) || defined(c_plusplus)
332     unsigned char	c_class;
333 #else
334     unsigned char	class;
335 #endif
336     unsigned char	length;
337     } XInputClass;
338 
339 typedef struct {
340     int           type;
341     unsigned long serial;       /* # of last request processed by server */
342     Bool          send_event;   /* true if this came from a SendEvent request */
343     Display       *display;     /* Display the event was read from */
344     Window        window;
345     XID           deviceid;
346     Time          time;
347     int           num_classes;
348     char	  data[64];
349 } XDeviceStateNotifyEvent;
350 
351 typedef struct {
352 #if defined(__cplusplus) || defined(c_plusplus)
353     unsigned char	c_class;
354 #else
355     unsigned char	class;
356 #endif
357     unsigned char	length;
358     unsigned char	num_valuators;
359     unsigned char	mode;
360     int        		valuators[6];
361 } XValuatorStatus;
362 
363 typedef struct {
364 #if defined(__cplusplus) || defined(c_plusplus)
365     unsigned char	c_class;
366 #else
367     unsigned char	class;
368 #endif
369     unsigned char	length;
370     short		num_keys;
371     char        	keys[32];
372 } XKeyStatus;
373 
374 typedef struct {
375 #if defined(__cplusplus) || defined(c_plusplus)
376     unsigned char	c_class;
377 #else
378     unsigned char	class;
379 #endif
380     unsigned char	length;
381     short		num_buttons;
382     char        	buttons[32];
383 } XButtonStatus;
384 
385 /*******************************************************************
386  *
387  * DeviceMappingNotify event.  This event is sent when the key mapping,
388  * modifier mapping, or button mapping of an extension device is changed.
389  *
390  */
391 
392 typedef struct {
393     int           type;
394     unsigned long serial;       /* # of last request processed by server */
395     Bool          send_event;   /* true if this came from a SendEvent request */
396     Display       *display;     /* Display the event was read from */
397     Window        window;       /* unused */
398     XID           deviceid;
399     Time          time;
400     int           request;      /* one of MappingModifier, MappingKeyboard,
401                                     MappingPointer */
402     int           first_keycode;/* first keycode */
403     int           count;        /* defines range of change w. first_keycode*/
404 } XDeviceMappingEvent;
405 
406 /*******************************************************************
407  *
408  * ChangeDeviceNotify event.  This event is sent when an
409  * XChangeKeyboard or XChangePointer request is made.
410  *
411  */
412 
413 typedef struct {
414     int           type;
415     unsigned long serial;       /* # of last request processed by server */
416     Bool          send_event;   /* true if this came from a SendEvent request */
417     Display       *display;     /* Display the event was read from */
418     Window        window;       /* unused */
419     XID           deviceid;
420     Time          time;
421     int           request;      /* NewPointer or NewKeyboard */
422 } XChangeDeviceNotifyEvent;
423 
424 /*******************************************************************
425  *
426  * Control structures for input devices that support input class
427  * Feedback.  These are used by the XGetFeedbackControl and
428  * XChangeFeedbackControl functions.
429  *
430  */
431 
432 typedef struct {
433 #if defined(__cplusplus) || defined(c_plusplus)
434      XID            c_class;
435 #else
436      XID            class;
437 #endif
438      int            length;
439      XID            id;
440 } XFeedbackState;
441 
442 typedef struct {
443 #if defined(__cplusplus) || defined(c_plusplus)
444     XID     c_class;
445 #else
446     XID     class;
447 #endif
448     int     length;
449     XID     id;
450     int     click;
451     int     percent;
452     int     pitch;
453     int     duration;
454     int     led_mask;
455     int     global_auto_repeat;
456     char    auto_repeats[32];
457 } XKbdFeedbackState;
458 
459 typedef struct {
460 #if defined(__cplusplus) || defined(c_plusplus)
461     XID     c_class;
462 #else
463     XID     class;
464 #endif
465     int     length;
466     XID     id;
467     int     accelNum;
468     int     accelDenom;
469     int     threshold;
470 } XPtrFeedbackState;
471 
472 typedef struct {
473 #if defined(__cplusplus) || defined(c_plusplus)
474     XID     c_class;
475 #else
476     XID     class;
477 #endif
478     int     length;
479     XID     id;
480     int     resolution;
481     int     minVal;
482     int     maxVal;
483 } XIntegerFeedbackState;
484 
485 typedef struct {
486 #if defined(__cplusplus) || defined(c_plusplus)
487     XID     c_class;
488 #else
489     XID     class;
490 #endif
491     int     length;
492     XID     id;
493     int     max_symbols;
494     int     num_syms_supported;
495     KeySym  *syms_supported;
496 } XStringFeedbackState;
497 
498 typedef struct {
499 #if defined(__cplusplus) || defined(c_plusplus)
500     XID     c_class;
501 #else
502     XID     class;
503 #endif
504     int     length;
505     XID     id;
506     int     percent;
507     int     pitch;
508     int     duration;
509 } XBellFeedbackState;
510 
511 typedef struct {
512 #if defined(__cplusplus) || defined(c_plusplus)
513     XID     c_class;
514 #else
515     XID     class;
516 #endif
517     int     length;
518     XID     id;
519     int     led_values;
520     int     led_mask;
521 } XLedFeedbackState;
522 
523 typedef struct {
524 #if defined(__cplusplus) || defined(c_plusplus)
525      XID            c_class;
526 #else
527      XID            class;
528 #endif
529      int            length;
530      XID	    id;
531 } XFeedbackControl;
532 
533 typedef struct {
534 #if defined(__cplusplus) || defined(c_plusplus)
535     XID     c_class;
536 #else
537     XID     class;
538 #endif
539     int     length;
540     XID     id;
541     int     accelNum;
542     int     accelDenom;
543     int     threshold;
544 } XPtrFeedbackControl;
545 
546 typedef struct {
547 #if defined(__cplusplus) || defined(c_plusplus)
548     XID     c_class;
549 #else
550     XID     class;
551 #endif
552     int     length;
553     XID     id;
554     int     click;
555     int     percent;
556     int     pitch;
557     int     duration;
558     int     led_mask;
559     int     led_value;
560     int     key;
561     int     auto_repeat_mode;
562 } XKbdFeedbackControl;
563 
564 typedef struct {
565 #if defined(__cplusplus) || defined(c_plusplus)
566     XID     c_class;
567 #else
568     XID     class;
569 #endif
570     int     length;
571     XID     id;
572     int     num_keysyms;
573     KeySym  *syms_to_display;
574 } XStringFeedbackControl;
575 
576 typedef struct {
577 #if defined(__cplusplus) || defined(c_plusplus)
578     XID     c_class;
579 #else
580     XID     class;
581 #endif
582     int     length;
583     XID     id;
584     int     int_to_display;
585 } XIntegerFeedbackControl;
586 
587 typedef struct {
588 #if defined(__cplusplus) || defined(c_plusplus)
589     XID     c_class;
590 #else
591     XID     class;
592 #endif
593     int     length;
594     XID     id;
595     int     percent;
596     int     pitch;
597     int     duration;
598 } XBellFeedbackControl;
599 
600 typedef struct {
601 #if defined(__cplusplus) || defined(c_plusplus)
602     XID     c_class;
603 #else
604     XID     class;
605 #endif
606     int     length;
607     XID     id;
608     int     led_mask;
609     int     led_values;
610 } XLedFeedbackControl;
611 
612 /*******************************************************************
613  *
614  * Device control structures.
615  *
616  */
617 
618 typedef struct {
619      XID            control;
620      int            length;
621 } XDeviceControl;
622 
623 typedef struct {
624      XID            control;
625      int            length;
626      int            first_valuator;
627      int            num_valuators;
628      int            *resolutions;
629 } XDeviceResolutionControl;
630 
631 typedef struct {
632      XID            control;
633      int            length;
634      int            num_valuators;
635      int            *resolutions;
636      int            *min_resolutions;
637      int            *max_resolutions;
638 } XDeviceResolutionState;
639 
640 /*******************************************************************
641  *
642  * An array of XDeviceList structures is returned by the
643  * XListInputDevices function.  Each entry contains information
644  * about one input device.  Among that information is an array of
645  * pointers to structures that describe the characteristics of
646  * the input device.
647  *
648  */
649 
650 typedef struct _XAnyClassinfo *XAnyClassPtr;
651 
652 typedef struct _XAnyClassinfo {
653 #if defined(__cplusplus) || defined(c_plusplus)
654     XID 	c_class;
655 #else
656     XID 	class;
657 #endif
658     int 	length;
659     } XAnyClassInfo;
660 
661 typedef struct _XDeviceInfo *XDeviceInfoPtr;
662 
663 typedef struct _XDeviceInfo
664     {
665     XID                 id;
666     Atom                type;
667     char                *name;
668     int                 num_classes;
669     int                 use;
670     XAnyClassPtr 	inputclassinfo;
671     } XDeviceInfo;
672 
673 typedef struct _XKeyInfo *XKeyInfoPtr;
674 
675 typedef struct _XKeyInfo
676     {
677 #if defined(__cplusplus) || defined(c_plusplus)
678     XID			c_class;
679 #else
680     XID			class;
681 #endif
682     int			length;
683     unsigned short      min_keycode;
684     unsigned short      max_keycode;
685     unsigned short      num_keys;
686     } XKeyInfo;
687 
688 typedef struct _XButtonInfo *XButtonInfoPtr;
689 
690 typedef struct _XButtonInfo {
691 #if defined(__cplusplus) || defined(c_plusplus)
692     XID		c_class;
693 #else
694     XID		class;
695 #endif
696     int		length;
697     short 	num_buttons;
698     } XButtonInfo;
699 
700 typedef struct _XAxisInfo *XAxisInfoPtr;
701 
702 typedef struct _XAxisInfo {
703     int 	resolution;
704     int 	min_value;
705     int 	max_value;
706     } XAxisInfo;
707 
708 typedef struct _XValuatorInfo *XValuatorInfoPtr;
709 
710 typedef struct	_XValuatorInfo
711     {
712 #if defined(__cplusplus) || defined(c_plusplus)
713     XID			c_class;
714 #else
715     XID			class;
716 #endif
717     int			length;
718     unsigned char       num_axes;
719     unsigned char       mode;
720     unsigned long       motion_buffer;
721     XAxisInfoPtr        axes;
722     } XValuatorInfo;
723 
724 
725 /*******************************************************************
726  *
727  * An XDevice structure is returned by the XOpenDevice function.
728  * It contains an array of pointers to XInputClassInfo structures.
729  * Each contains information about a class of input supported by the
730  * device, including a pointer to an array of data for each type of event
731  * the device reports.
732  *
733  */
734 
735 
736 typedef struct {
737         unsigned char   input_class;
738         unsigned char   event_type_base;
739 } XInputClassInfo;
740 
741 typedef struct {
742         XID                    device_id;
743         int                    num_classes;
744         XInputClassInfo        *classes;
745 } XDevice;
746 
747 
748 /*******************************************************************
749  *
750  * The following structure is used to return information for the
751  * XGetSelectedExtensionEvents function.
752  *
753  */
754 
755 typedef struct {
756         XEventClass     event_type;
757         XID             device;
758 } XEventList;
759 
760 /*******************************************************************
761  *
762  * The following structure is used to return motion history data from
763  * an input device that supports the input class Valuators.
764  * This information is returned by the XGetDeviceMotionEvents function.
765  *
766  */
767 
768 typedef struct {
769         Time   time;
770         int    *data;
771 } XDeviceTimeCoord;
772 
773 
774 /*******************************************************************
775  *
776  * Device state structure.
777  * This is returned by the XQueryDeviceState request.
778  *
779  */
780 
781 typedef struct {
782         XID		device_id;
783         int		num_classes;
784         XInputClass	*data;
785 } XDeviceState;
786 
787 /*******************************************************************
788  *
789  * Note that the mode field is a bitfield that reports the Proximity
790  * status of the device as well as the mode.  The mode field should
791  * be OR'd with the mask DeviceMode and compared with the values
792  * Absolute and Relative to determine the mode, and should be OR'd
793  * with the mask ProximityState and compared with the values InProximity
794  * and OutOfProximity to determine the proximity state.
795  *
796  */
797 
798 typedef struct {
799 #if defined(__cplusplus) || defined(c_plusplus)
800     unsigned char	c_class;
801 #else
802     unsigned char	class;
803 #endif
804     unsigned char	length;
805     unsigned char	num_valuators;
806     unsigned char	mode;
807     int        		*valuators;
808 } XValuatorState;
809 
810 typedef struct {
811 #if defined(__cplusplus) || defined(c_plusplus)
812     unsigned char	c_class;
813 #else
814     unsigned char	class;
815 #endif
816     unsigned char	length;
817     short		num_keys;
818     char        	keys[32];
819 } XKeyState;
820 
821 typedef struct {
822 #if defined(__cplusplus) || defined(c_plusplus)
823     unsigned char	c_class;
824 #else
825     unsigned char	class;
826 #endif
827     unsigned char	length;
828     short		num_buttons;
829     char        	buttons[32];
830 } XButtonState;
831 
832 /*******************************************************************
833  *
834  * Function definitions.
835  *
836  */
837 
838 _XFUNCPROTOBEGIN
839 
840 extern int	XChangeKeyboardDevice(
841 #if NeedFunctionPrototypes
842     Display*		/* display */,
843     XDevice*		/* device */
844 #endif
845 );
846 
847 extern int	XChangePointerDevice(
848 #if NeedFunctionPrototypes
849     Display*		/* display */,
850     XDevice*		/* device */,
851     int			/* xaxis */,
852     int			/* yaxis */
853 #endif
854 );
855 
856 extern int	XGrabDevice(
857 #if NeedFunctionPrototypes
858     Display*		/* display */,
859     XDevice*		/* device */,
860     Window		/* grab_window */,
861     Bool		/* ownerEvents */,
862     int			/* event count */,
863     XEventClass*	/* event_list */,
864     int			/* this_device_mode */,
865     int			/* other_devices_mode */,
866     Time		/* time */
867 #endif
868 );
869 
870 extern int	XUngrabDevice(
871 #if NeedFunctionPrototypes
872     Display*		/* display */,
873     XDevice*		/* device */,
874     Time 		/* time */
875 #endif
876 );
877 
878 extern int	XGrabDeviceKey(
879 #if NeedFunctionPrototypes
880     Display*		/* display */,
881     XDevice*		/* device */,
882     unsigned int	/* key */,
883     unsigned int	/* modifiers */,
884     XDevice*		/* modifier_device */,
885     Window		/* grab_window */,
886     Bool		/* owner_events */,
887     unsigned int	/* event_count */,
888     XEventClass*	/* event_list */,
889     int			/* this_device_mode */,
890     int			/* other_devices_mode */
891 #endif
892 );
893 
894 extern int	XUngrabDeviceKey(
895 #if NeedFunctionPrototypes
896     Display*		/* display */,
897     XDevice*		/* device */,
898     unsigned int	/* key */,
899     unsigned int	/* modifiers */,
900     XDevice*		/* modifier_dev */,
901     Window		/* grab_window */
902 #endif
903 );
904 
905 extern int	XGrabDeviceButton(
906 #if NeedFunctionPrototypes
907     Display*		/* display */,
908     XDevice*		/* device */,
909     unsigned int	/* button */,
910     unsigned int	/* modifiers */,
911     XDevice*		/* modifier_device */,
912     Window		/* grab_window */,
913     Bool		/* owner_events */,
914     unsigned int	/* event_count */,
915     XEventClass*	/* event_list */,
916     int			/* this_device_mode */,
917     int			/* other_devices_mode */
918 #endif
919 );
920 
921 extern int	XUngrabDeviceButton(
922 #if NeedFunctionPrototypes
923     Display*		/* display */,
924     XDevice*		/* device */,
925     unsigned int	/* button */,
926     unsigned int	/* modifiers */,
927     XDevice*		/* modifier_dev */,
928     Window		/* grab_window */
929 #endif
930 );
931 
932 extern int	XAllowDeviceEvents(
933 #if NeedFunctionPrototypes
934     Display*		/* display */,
935     XDevice*		/* device */,
936     int			/* event_mode */,
937     Time		/* time */
938 #endif
939 );
940 
941 extern int	XGetDeviceFocus(
942 #if NeedFunctionPrototypes
943     Display*		/* display */,
944     XDevice*		/* device */,
945     Window*		/* focus */,
946     int*		/* revert_to */,
947     Time*		/* time */
948 #endif
949 );
950 
951 extern int	XSetDeviceFocus(
952 #if NeedFunctionPrototypes
953     Display*		/* display */,
954     XDevice*		/* device */,
955     Window		/* focus */,
956     int			/* revert_to */,
957     Time		/* time */
958 #endif
959 );
960 
961 extern XFeedbackState	*XGetFeedbackControl(
962 #if NeedFunctionPrototypes
963     Display*		/* display */,
964     XDevice*		/* device */,
965     int*		/* num_feedbacks */
966 #endif
967 );
968 
969 extern int	XFreeFeedbackList(
970 #if NeedFunctionPrototypes
971     XFeedbackState*	/* list */
972 #endif
973 );
974 
975 extern int	XChangeFeedbackControl(
976 #if NeedFunctionPrototypes
977     Display*		/* display */,
978     XDevice*		/* device */,
979     unsigned long	/* mask */,
980     XFeedbackControl*	/* f */
981 #endif
982 );
983 
984 extern int	XDeviceBell(
985 #if NeedFunctionPrototypes
986     Display*		/* display */,
987     XDevice*		/* device */,
988     XID			/* feedbackclass */,
989     XID			/* feedbackid */,
990     int			/* percent */
991 #endif
992 );
993 
994 extern KeySym	*XGetDeviceKeyMapping(
995 #if NeedFunctionPrototypes
996     Display*		/* display */,
997     XDevice*		/* device */,
998 #if NeedWidePrototypes
999     unsigned int	/* first */,
1000 #else
1001     KeyCode		/* first */,
1002 #endif
1003     int			/* keycount */,
1004     int*		/* syms_per_code */
1005 #endif
1006 );
1007 
1008 extern int	XChangeDeviceKeyMapping(
1009 #if NeedFunctionPrototypes
1010     Display*		/* display */,
1011     XDevice*		/* device */,
1012     int			/* first */,
1013     int			/* syms_per_code */,
1014     KeySym*		/* keysyms */,
1015     int			/* count */
1016 #endif
1017 );
1018 
1019 extern XModifierKeymap	*XGetDeviceModifierMapping(
1020 #if NeedFunctionPrototypes
1021     Display*		/* display */,
1022     XDevice*		/* device */
1023 #endif
1024 );
1025 
1026 extern int	XSetDeviceModifierMapping(
1027 #if NeedFunctionPrototypes
1028     Display*		/* display */,
1029     XDevice*		/* device */,
1030     XModifierKeymap*	/* modmap */
1031 #endif
1032 );
1033 
1034 extern int	XSetDeviceButtonMapping(
1035 #if NeedFunctionPrototypes
1036     Display*		/* display */,
1037     XDevice*		/* device */,
1038     unsigned char*	/* map[] */,
1039     int			/* nmap */
1040 #endif
1041 );
1042 
1043 extern int	XGetDeviceButtonMapping(
1044 #if NeedFunctionPrototypes
1045     Display*		/* display */,
1046     XDevice*		/* device */,
1047     unsigned char*	/* map[] */,
1048     unsigned int	/* nmap */
1049 #endif
1050 );
1051 
1052 extern XDeviceState	*XQueryDeviceState(
1053 #if NeedFunctionPrototypes
1054     Display*		/* display */,
1055     XDevice*		/* device */
1056 #endif
1057 );
1058 
1059 extern int	XFreeDeviceState(
1060 #if NeedFunctionPrototypes
1061     XDeviceState*	/* list */
1062 #endif
1063 );
1064 
1065 extern XExtensionVersion	*XGetExtensionVersion(
1066 #if NeedFunctionPrototypes
1067     Display*		/* display */,
1068     _Xconst char*	/* name */
1069 #endif
1070 );
1071 
1072 extern XDeviceInfo	*XListInputDevices(
1073 #if NeedFunctionPrototypes
1074     Display*		/* display */,
1075     int*		/* ndevices */
1076 #endif
1077 );
1078 
1079 extern int	XFreeDeviceList(
1080 #if NeedFunctionPrototypes
1081     XDeviceInfo*	/* list */
1082 #endif
1083 );
1084 
1085 extern XDevice	*XOpenDevice(
1086 #if NeedFunctionPrototypes
1087     Display*		/* display */,
1088     XID			/* id */
1089 #endif
1090 );
1091 
1092 extern int	XCloseDevice(
1093 #if NeedFunctionPrototypes
1094     Display*		/* display */,
1095     XDevice*		/* device */
1096 #endif
1097 );
1098 
1099 extern int	XSetDeviceMode(
1100 #if NeedFunctionPrototypes
1101     Display*		/* display */,
1102     XDevice*		/* device */,
1103     int			/* mode */
1104 #endif
1105 );
1106 
1107 extern int	XSetDeviceValuators(
1108 #if NeedFunctionPrototypes
1109     Display*		/* display */,
1110     XDevice*		/* device */,
1111     int*		/* valuators */,
1112     int			/* first_valuator */,
1113     int			/* num_valuators */
1114 #endif
1115 );
1116 
1117 extern XDeviceControl	*XGetDeviceControl(
1118 #if NeedFunctionPrototypes
1119     Display*		/* display */,
1120     XDevice*		/* device */,
1121     int			/* control */
1122 #endif
1123 );
1124 
1125 extern int	XChangeDeviceControl(
1126 #if NeedFunctionPrototypes
1127     Display*		/* display */,
1128     XDevice*		/* device */,
1129     int			/* control */,
1130     XDeviceControl*	/* d */
1131 #endif
1132 );
1133 
1134 extern int	XSelectExtensionEvent(
1135 #if NeedFunctionPrototypes
1136     Display*		/* display */,
1137     Window		/* w */,
1138     XEventClass*	/* event_list */,
1139     int			/* count */
1140 #endif
1141 );
1142 
1143 extern int XGetSelectedExtensionEvents(
1144 #if NeedFunctionPrototypes
1145     Display*		/* display */,
1146     Window		/* w */,
1147     int*		/* this_client_count */,
1148     XEventClass**	/* this_client_list */,
1149     int*		/* all_clients_count */,
1150     XEventClass**	/* all_clients_list */
1151 #endif
1152 );
1153 
1154 extern int	XChangeDeviceDontPropagateList(
1155 #if NeedFunctionPrototypes
1156     Display*		/* display */,
1157     Window		/* window */,
1158     int			/* count */,
1159     XEventClass*	/* events */,
1160     int			/* mode */
1161 #endif
1162 );
1163 
1164 extern XEventClass	*XGetDeviceDontPropagateList(
1165 #if NeedFunctionPrototypes
1166     Display*		/* display */,
1167     Window		/* window */,
1168     int*		/* count */
1169 #endif
1170 );
1171 
1172 extern Status	XSendExtensionEvent(
1173 #if NeedFunctionPrototypes
1174     Display*		/* display */,
1175     XDevice*		/* device */,
1176     Window		/* dest */,
1177     Bool		/* prop */,
1178     int			/* count */,
1179     XEventClass*	/* list */,
1180     XEvent*		/* event */
1181 #endif
1182 );
1183 
1184 extern XDeviceTimeCoord	*XGetDeviceMotionEvents(
1185 #if NeedFunctionPrototypes
1186     Display*		/* display */,
1187     XDevice*		/* device */,
1188     Time		/* start */,
1189     Time		/* stop */,
1190     int*		/* nEvents */,
1191     int*		/* mode */,
1192     int*		/* axis_count */
1193 #endif
1194 );
1195 
1196 extern int	XFreeDeviceMotionEvents(
1197 #if NeedFunctionPrototypes
1198     XDeviceTimeCoord*	/* events */
1199 #endif
1200 );
1201 
1202 extern int	XFreeDeviceControl(
1203 #if NeedFunctionPrototypes
1204     XDeviceControl*	/* control */
1205 #endif
1206 );
1207 
1208 _XFUNCPROTOEND
1209 
1210 #endif /* _XINPUT_H_ */
1211