XInput.h revision 74fe172698ba936102e120dae998c9ebd09cfbdf
/* $Xorg: XInput.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
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.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Hewlett-Packard not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
HEWLETT-PACKARD 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/include/extensions/XInput.h,v 1.3 2001/12/14 19:53:28 dawes Exp $ */
/* Definitions used by the library and client */
#ifndef _XINPUT_H_
#define _XINPUT_H_
#define _deviceKeyPress 0
#define _deviceKeyRelease 1
#define _deviceButtonPress 0
#define _deviceButtonRelease 1
#define _deviceMotionNotify 0
#define _deviceFocusIn 0
#define _deviceFocusOut 1
#define _proximityIn 0
#define _proximityOut 1
#define _deviceStateNotify 0
#define _deviceMappingNotify 1
#define _changeDeviceNotify 2
/***************************************************************
*
* DeviceKey events. These events are sent by input devices that
* support input class Keys.
* The location of the X pointer is reported in the coordinate
* fields of the x,y and x_root,y_root fields.
*
*/
typedef struct
{
int type; /* of event */
unsigned long serial; /* # of last request processed */
int x, y; /* x, y coordinates in event window */
int x_root; /* coordinates relative to root */
int y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int keycode; /* detail */
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
/*******************************************************************
*
* DeviceButton events. These events are sent by extension devices
* that support input class Buttons.
*
*/
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int x, y; /* x, y coordinates in event window */
int x_root; /* coordinates relative to root */
int y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int button; /* detail */
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
/*******************************************************************
*
* DeviceMotionNotify event. These events are sent by extension devices
* that support input class Valuators.
*
*/
typedef struct
{
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int x, y; /* x, y coordinates in event window */
int x_root; /* coordinates relative to root */
int y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
char is_hint; /* detail */
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
/*******************************************************************
*
* DeviceFocusChange events. These events are sent when the focus
* of an extension device that can be focused is changed.
*
*/
typedef struct
{
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
int detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
* NotifyPointerRoot, NotifyDetailNone
*/
/*******************************************************************
*
* ProximityNotify events. These events are sent by those absolute
* positioning devices that are capable of generating proximity information.
*
*/
typedef struct
{
int type; /* ProximityIn or ProximityOut */
unsigned long serial; /* # of last request processed by server */
int x, y;
unsigned int state;
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
typedef XProximityNotifyEvent XProximityInEvent;
typedef XProximityNotifyEvent XProximityOutEvent;
/*******************************************************************
*
* DeviceStateNotify events are generated on EnterWindow and FocusIn
* for those clients who have selected DeviceState.
*
*/
typedef struct
{
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
} XInputClass;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
int num_classes;
char data[64];
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
unsigned char num_valuators;
unsigned char mode;
int valuators[6];
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_keys;
char keys[32];
} XKeyStatus;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_buttons;
char buttons[32];
/*******************************************************************
*
* DeviceMappingNotify event. This event is sent when the key mapping,
* modifier mapping, or button mapping of an extension device is changed.
*
*/
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
int request; /* one of MappingModifier, MappingKeyboard,
MappingPointer */
int first_keycode;/* first keycode */
int count; /* defines range of change w. first_keycode*/
/*******************************************************************
*
* ChangeDeviceNotify event. This event is sent when an
* XChangeKeyboard or XChangePointer request is made.
*
*/
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
int request; /* NewPointer or NewKeyboard */
/*******************************************************************
*
* Control structures for input devices that support input class
* Feedback. These are used by the XGetFeedbackControl and
* XChangeFeedbackControl functions.
*
*/
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int click;
int percent;
int pitch;
int duration;
int led_mask;
int global_auto_repeat;
char auto_repeats[32];
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int accelNum;
int accelDenom;
int threshold;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int resolution;
int minVal;
int maxVal;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int max_symbols;
int num_syms_supported;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int percent;
int pitch;
int duration;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int led_values;
int led_mask;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int accelNum;
int accelDenom;
int threshold;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int click;
int percent;
int pitch;
int duration;
int led_mask;
int led_value;
int key;
int auto_repeat_mode;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int num_keysyms;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int int_to_display;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int percent;
int pitch;
int duration;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
int led_mask;
int led_values;
/*******************************************************************
*
* Device control structures.
*
*/
typedef struct {
int length;
typedef struct {
int length;
int first_valuator;
int num_valuators;
int *resolutions;
typedef struct {
int length;
int num_valuators;
int *resolutions;
int *min_resolutions;
int *max_resolutions;
/*******************************************************************
*
* An array of XDeviceList structures is returned by the
* XListInputDevices function. Each entry contains information
* about one input device. Among that information is an array of
* pointers to structures that describe the characteristics of
* the input device.
*
*/
typedef struct _XAnyClassinfo *XAnyClassPtr;
typedef struct _XAnyClassinfo {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
typedef struct _XDeviceInfo *XDeviceInfoPtr;
typedef struct _XDeviceInfo
{
char *name;
int num_classes;
int use;
} XDeviceInfo;
typedef struct _XKeyInfo *XKeyInfoPtr;
typedef struct _XKeyInfo
{
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
unsigned short min_keycode;
unsigned short max_keycode;
unsigned short num_keys;
} XKeyInfo;
typedef struct _XButtonInfo *XButtonInfoPtr;
typedef struct _XButtonInfo {
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
short num_buttons;
} XButtonInfo;
typedef struct _XAxisInfo *XAxisInfoPtr;
typedef struct _XAxisInfo {
int resolution;
int min_value;
int max_value;
} XAxisInfo;
typedef struct _XValuatorInfo *XValuatorInfoPtr;
typedef struct _XValuatorInfo
{
#if defined(__cplusplus) || defined(c_plusplus)
#else
#endif
int length;
unsigned char num_axes;
unsigned char mode;
unsigned long motion_buffer;
/*******************************************************************
*
* An XDevice structure is returned by the XOpenDevice function.
* It contains an array of pointers to XInputClassInfo structures.
* Each contains information about a class of input supported by the
* device, including a pointer to an array of data for each type of event
* the device reports.
*
*/
typedef struct {
unsigned char input_class;
unsigned char event_type_base;
typedef struct {
int num_classes;
} XDevice;
/*******************************************************************
*
* The following structure is used to return information for the
* XGetSelectedExtensionEvents function.
*
*/
typedef struct {
} XEventList;
/*******************************************************************
*
* The following structure is used to return motion history data from
* an input device that supports the input class Valuators.
* This information is returned by the XGetDeviceMotionEvents function.
*
*/
typedef struct {
int *data;
/*******************************************************************
*
* Device state structure.
* This is returned by the XQueryDeviceState request.
*
*/
typedef struct {
int num_classes;
} XDeviceState;
/*******************************************************************
*
* Note that the mode field is a bitfield that reports the Proximity
* status of the device as well as the mode. The mode field should
* be OR'd with the mask DeviceMode and compared with the values
* Absolute and Relative to determine the mode, and should be OR'd
* with the mask ProximityState and compared with the values InProximity
* and OutOfProximity to determine the proximity state.
*
*/
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
unsigned char num_valuators;
unsigned char mode;
int *valuators;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_keys;
char keys[32];
} XKeyState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_buttons;
char buttons[32];
} XButtonState;
/*******************************************************************
*
* Function definitions.
*
*/
extern int XChangeKeyboardDevice(
Display* /* display */,
XDevice* /* device */
#endif
);
extern int XChangePointerDevice(
Display* /* display */,
XDevice* /* device */,
int /* xaxis */,
int /* yaxis */
#endif
);
extern int XGrabDevice(
Display* /* display */,
XDevice* /* device */,
Window /* grab_window */,
Bool /* ownerEvents */,
int /* event count */,
XEventClass* /* event_list */,
int /* this_device_mode */,
int /* other_devices_mode */,
Time /* time */
#endif
);
extern int XUngrabDevice(
Display* /* display */,
XDevice* /* device */,
Time /* time */
#endif
);
extern int XGrabDeviceKey(
Display* /* display */,
XDevice* /* device */,
unsigned int /* key */,
unsigned int /* modifiers */,
XDevice* /* modifier_device */,
Window /* grab_window */,
Bool /* owner_events */,
unsigned int /* event_count */,
XEventClass* /* event_list */,
int /* this_device_mode */,
int /* other_devices_mode */
#endif
);
extern int XUngrabDeviceKey(
Display* /* display */,
XDevice* /* device */,
unsigned int /* key */,
unsigned int /* modifiers */,
XDevice* /* modifier_dev */,
Window /* grab_window */
#endif
);
extern int XGrabDeviceButton(
Display* /* display */,
XDevice* /* device */,
unsigned int /* button */,
unsigned int /* modifiers */,
XDevice* /* modifier_device */,
Window /* grab_window */,
Bool /* owner_events */,
unsigned int /* event_count */,
XEventClass* /* event_list */,
int /* this_device_mode */,
int /* other_devices_mode */
#endif
);
extern int XUngrabDeviceButton(
Display* /* display */,
XDevice* /* device */,
unsigned int /* button */,
unsigned int /* modifiers */,
XDevice* /* modifier_dev */,
Window /* grab_window */
#endif
);
extern int XAllowDeviceEvents(
Display* /* display */,
XDevice* /* device */,
int /* event_mode */,
Time /* time */
#endif
);
extern int XGetDeviceFocus(
Display* /* display */,
XDevice* /* device */,
Window* /* focus */,
int* /* revert_to */,
Time* /* time */
#endif
);
extern int XSetDeviceFocus(
Display* /* display */,
XDevice* /* device */,
Window /* focus */,
int /* revert_to */,
Time /* time */
#endif
);
extern XFeedbackState *XGetFeedbackControl(
Display* /* display */,
XDevice* /* device */,
int* /* num_feedbacks */
#endif
);
extern void XFreeFeedbackList(
XFeedbackState* /* list */
#endif
);
extern int XChangeFeedbackControl(
Display* /* display */,
XDevice* /* device */,
unsigned long /* mask */,
XFeedbackControl* /* f */
#endif
);
extern int XDeviceBell(
Display* /* display */,
XDevice* /* device */,
XID /* feedbackclass */,
XID /* feedbackid */,
int /* percent */
#endif
);
extern KeySym *XGetDeviceKeyMapping(
Display* /* display */,
XDevice* /* device */,
unsigned int /* first */,
#else
KeyCode /* first */,
#endif
int /* keycount */,
int* /* syms_per_code */
#endif
);
extern int XChangeDeviceKeyMapping(
Display* /* display */,
XDevice* /* device */,
int /* first */,
int /* syms_per_code */,
KeySym* /* keysyms */,
int /* count */
#endif
);
extern XModifierKeymap *XGetDeviceModifierMapping(
Display* /* display */,
XDevice* /* device */
#endif
);
extern int XSetDeviceModifierMapping(
Display* /* display */,
XDevice* /* device */,
XModifierKeymap* /* modmap */
#endif
);
extern int XSetDeviceButtonMapping(
Display* /* display */,
XDevice* /* device */,
unsigned char* /* map[] */,
int /* nmap */
#endif
);
extern int XGetDeviceButtonMapping(
Display* /* display */,
XDevice* /* device */,
unsigned char* /* map[] */,
unsigned int /* nmap */
#endif
);
extern XDeviceState *XQueryDeviceState(
Display* /* display */,
XDevice* /* device */
#endif
);
extern void XFreeDeviceState(
XDeviceState* /* list */
#endif
);
extern XExtensionVersion *XGetExtensionVersion(
Display* /* display */,
_Xconst char* /* name */
#endif
);
extern XDeviceInfo *XListInputDevices(
Display* /* display */,
int* /* ndevices */
#endif
);
extern void XFreeDeviceList(
XDeviceInfo* /* list */
#endif
);
extern XDevice *XOpenDevice(
Display* /* display */,
XID /* id */
#endif
);
extern int XCloseDevice(
Display* /* display */,
XDevice* /* device */
#endif
);
extern int XSetDeviceMode(
Display* /* display */,
XDevice* /* device */,
int /* mode */
#endif
);
extern int XSetDeviceValuators(
Display* /* display */,
XDevice* /* device */,
int* /* valuators */,
int /* first_valuator */,
int /* num_valuators */
#endif
);
extern XDeviceControl *XGetDeviceControl(
Display* /* display */,
XDevice* /* device */,
int /* control */
#endif
);
extern int XChangeDeviceControl(
Display* /* display */,
XDevice* /* device */,
int /* control */,
XDeviceControl* /* d */
#endif
);
extern int XSelectExtensionEvent(
Display* /* display */,
Window /* w */,
XEventClass* /* event_list */,
int /* count */
#endif
);
extern int XGetSelectedExtensionEvents(
Display* /* display */,
Window /* w */,
int* /* this_client_count */,
XEventClass** /* this_client_list */,
int* /* all_clients_count */,
XEventClass** /* all_clients_list */
#endif
);
extern int XChangeDeviceDontPropagateList(
Display* /* display */,
Window /* window */,
int /* count */,
XEventClass* /* events */,
int /* mode */
#endif
);
extern XEventClass *XGetDeviceDontPropagateList(
Display* /* display */,
Window /* window */,
int* /* count */
#endif
);
extern Status XSendExtensionEvent(
Display* /* display */,
XDevice* /* device */,
Window /* dest */,
Bool /* prop */,
int /* count */,
XEventClass* /* list */,
XEvent* /* event */
#endif
);
extern XDeviceTimeCoord *XGetDeviceMotionEvents(
Display* /* display */,
XDevice* /* device */,
Time /* start */,
Time /* stop */,
int* /* nEvents */,
int* /* mode */,
int* /* axis_count */
#endif
);
extern void XFreeDeviceMotionEvents(
XDeviceTimeCoord* /* events */
#endif
);
extern void XFreeDeviceControl(
XDeviceControl* /* control */
#endif
);
#endif /* _XINPUT_H_ */