Path: blob/master/thirdparty/linuxbsd_headers/X11/extensions/XInput2.h
9905 views
/*1* Copyright © 2009 Red Hat, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*22*/2324/* Definitions used by the library and client */2526#ifndef _XINPUT2_H_27#define _XINPUT2_H_2829#include <X11/Xlib.h>30#include <X11/extensions/XI2.h>31#include <X11/extensions/Xge.h>32#include <X11/extensions/Xfixes.h> /* PointerBarrier */3334/*******************************************************************35*36*/37typedef struct {38int type;39char* name;40Bool send_core;41Bool enable;42} XIAddMasterInfo;4344typedef struct {45int type;46int deviceid;47int return_mode; /* AttachToMaster, Floating */48int return_pointer;49int return_keyboard;50} XIRemoveMasterInfo;5152typedef struct {53int type;54int deviceid;55int new_master;56} XIAttachSlaveInfo;5758typedef struct {59int type;60int deviceid;61} XIDetachSlaveInfo;6263typedef union {64int type; /* must be first element */65XIAddMasterInfo add;66XIRemoveMasterInfo remove;67XIAttachSlaveInfo attach;68XIDetachSlaveInfo detach;69} XIAnyHierarchyChangeInfo;7071typedef struct72{73int base;74int latched;75int locked;76int effective;77} XIModifierState;7879typedef XIModifierState XIGroupState;8081typedef struct {82int mask_len;83unsigned char *mask;84} XIButtonState;8586typedef struct {87int mask_len;88unsigned char *mask;89double *values;90} XIValuatorState;919293typedef struct94{95int deviceid;96int mask_len;97unsigned char* mask;98} XIEventMask;99100typedef struct101{102int type;103int sourceid;104} XIAnyClassInfo;105106typedef struct107{108int type;109int sourceid;110int num_buttons;111Atom *labels;112XIButtonState state;113} XIButtonClassInfo;114115typedef struct116{117int type;118int sourceid;119int num_keycodes;120int *keycodes;121} XIKeyClassInfo;122123typedef struct124{125int type;126int sourceid;127int number;128Atom label;129double min;130double max;131double value;132int resolution;133int mode;134} XIValuatorClassInfo;135136/* new in XI 2.1 */137typedef struct138{139int type;140int sourceid;141int number;142int scroll_type;143double increment;144int flags;145} XIScrollClassInfo;146147typedef struct148{149int type;150int sourceid;151int mode;152int num_touches;153} XITouchClassInfo;154155typedef struct156{157int deviceid;158char *name;159int use;160int attachment;161Bool enabled;162int num_classes;163XIAnyClassInfo **classes;164} XIDeviceInfo;165166typedef struct167{168int modifiers;169int status;170} XIGrabModifiers;171172typedef unsigned int BarrierEventID;173174typedef struct175{176int deviceid;177PointerBarrier barrier;178BarrierEventID eventid;179} XIBarrierReleasePointerInfo;180181/**182* Generic XI2 event. All XI2 events have the same header.183*/184typedef struct {185int type; /* GenericEvent */186unsigned long serial; /* # of last request processed by server */187Bool send_event; /* true if this came from a SendEvent request */188Display *display; /* Display the event was read from */189int extension; /* XI extension offset */190int evtype;191Time time;192} XIEvent;193194195typedef struct {196int deviceid;197int attachment;198int use;199Bool enabled;200int flags;201} XIHierarchyInfo;202203/*204* Notifies the client that the device hierarchy has been changed. The client205* is expected to re-query the server for the device hierarchy.206*/207typedef struct {208int type; /* GenericEvent */209unsigned long serial; /* # of last request processed by server */210Bool send_event; /* true if this came from a SendEvent request */211Display *display; /* Display the event was read from */212int extension; /* XI extension offset */213int evtype; /* XI_HierarchyChanged */214Time time;215int flags;216int num_info;217XIHierarchyInfo *info;218} XIHierarchyEvent;219220/*221* Notifies the client that the classes have been changed. This happens when222* the slave device that sends through the master changes.223*/224typedef struct {225int type; /* GenericEvent */226unsigned long serial; /* # of last request processed by server */227Bool send_event; /* true if this came from a SendEvent request */228Display *display; /* Display the event was read from */229int extension; /* XI extension offset */230int evtype; /* XI_DeviceChanged */231Time time;232int deviceid; /* id of the device that changed */233int sourceid; /* Source for the new classes. */234int reason; /* Reason for the change */235int num_classes;236XIAnyClassInfo **classes; /* same as in XIDeviceInfo */237} XIDeviceChangedEvent;238239typedef struct {240int type; /* GenericEvent */241unsigned long serial; /* # of last request processed by server */242Bool send_event; /* true if this came from a SendEvent request */243Display *display; /* Display the event was read from */244int extension; /* XI extension offset */245int evtype;246Time time;247int deviceid;248int sourceid;249int detail;250Window root;251Window event;252Window child;253double root_x;254double root_y;255double event_x;256double event_y;257int flags;258XIButtonState buttons;259XIValuatorState valuators;260XIModifierState mods;261XIGroupState group;262} XIDeviceEvent;263264typedef struct {265int type; /* GenericEvent */266unsigned long serial; /* # of last request processed by server */267Bool send_event; /* true if this came from a SendEvent request */268Display *display; /* Display the event was read from */269int extension; /* XI extension offset */270int evtype; /* XI_RawKeyPress, XI_RawKeyRelease, etc. */271Time time;272int deviceid;273int sourceid; /* Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 */274int detail;275int flags;276XIValuatorState valuators;277double *raw_values;278} XIRawEvent;279280typedef struct {281int type; /* GenericEvent */282unsigned long serial; /* # of last request processed by server */283Bool send_event; /* true if this came from a SendEvent request */284Display *display; /* Display the event was read from */285int extension; /* XI extension offset */286int evtype;287Time time;288int deviceid;289int sourceid;290int detail;291Window root;292Window event;293Window child;294double root_x;295double root_y;296double event_x;297double event_y;298int mode;299Bool focus;300Bool same_screen;301XIButtonState buttons;302XIModifierState mods;303XIGroupState group;304} XIEnterEvent;305306typedef XIEnterEvent XILeaveEvent;307typedef XIEnterEvent XIFocusInEvent;308typedef XIEnterEvent XIFocusOutEvent;309310typedef struct {311int type; /* GenericEvent */312unsigned long serial; /* # of last request processed by server */313Bool send_event; /* true if this came from a SendEvent request */314Display *display; /* Display the event was read from */315int extension; /* XI extension offset */316int evtype; /* XI_PropertyEvent */317Time time;318int deviceid; /* id of the device that changed */319Atom property;320int what;321} XIPropertyEvent;322323typedef struct {324int type; /* GenericEvent */325unsigned long serial; /* # of last request processed by server */326Bool send_event; /* true if this came from a SendEvent request */327Display *display; /* Display the event was read from */328int extension; /* XI extension offset */329int evtype;330Time time;331int deviceid;332int sourceid;333unsigned int touchid;334Window root;335Window event;336Window child;337int flags;338} XITouchOwnershipEvent;339340typedef struct {341int type; /* GenericEvent */342unsigned long serial; /* # of last request processed by server */343Bool send_event; /* true if this came from a SendEvent request */344Display *display; /* Display the event was read from */345int extension; /* XI extension offset */346int evtype;347Time time;348int deviceid;349int sourceid;350Window event;351Window root;352double root_x;353double root_y;354double dx;355double dy;356int dtime;357int flags;358PointerBarrier barrier;359BarrierEventID eventid;360} XIBarrierEvent;361362_XFUNCPROTOBEGIN363364extern Bool XIQueryPointer(365Display* display,366int deviceid,367Window win,368Window* root,369Window* child,370double* root_x,371double* root_y,372double* win_x,373double* win_y,374XIButtonState *buttons,375XIModifierState *mods,376XIGroupState *group377);378379extern Bool XIWarpPointer(380Display* display,381int deviceid,382Window src_win,383Window dst_win,384double src_x,385double src_y,386unsigned int src_width,387unsigned int src_height,388double dst_x,389double dst_y390);391392extern Status XIDefineCursor(393Display* display,394int deviceid,395Window win,396Cursor cursor397);398399extern Status XIUndefineCursor(400Display* display,401int deviceid,402Window win403);404405extern Status XIChangeHierarchy(406Display* display,407XIAnyHierarchyChangeInfo* changes,408int num_changes409);410411extern Status XISetClientPointer(412Display* dpy,413Window win,414int deviceid415);416417extern Bool XIGetClientPointer(418Display* dpy,419Window win,420int* deviceid421);422423extern int XISelectEvents(424Display* dpy,425Window win,426XIEventMask *masks,427int num_masks428);429430extern XIEventMask *XIGetSelectedEvents(431Display* dpy,432Window win,433int *num_masks_return434);435436extern Status XIQueryVersion(437Display* dpy,438int* major_version_inout,439int* minor_version_inout440);441442extern XIDeviceInfo* XIQueryDevice(443Display* dpy,444int deviceid,445int* ndevices_return446);447448extern Status XISetFocus(449Display* dpy,450int deviceid,451Window focus,452Time time453);454455extern Status XIGetFocus(456Display* dpy,457int deviceid,458Window *focus_return);459460extern Status XIGrabDevice(461Display* dpy,462int deviceid,463Window grab_window,464Time time,465Cursor cursor,466int grab_mode,467int paired_device_mode,468Bool owner_events,469XIEventMask *mask470);471472extern Status XIUngrabDevice(473Display* dpy,474int deviceid,475Time time476);477478extern Status XIAllowEvents(479Display* display,480int deviceid,481int event_mode,482Time time483);484485extern Status XIAllowTouchEvents(486Display* display,487int deviceid,488unsigned int touchid,489Window grab_window,490int event_mode491);492493extern int XIGrabButton(494Display* display,495int deviceid,496int button,497Window grab_window,498Cursor cursor,499int grab_mode,500int paired_device_mode,501int owner_events,502XIEventMask *mask,503int num_modifiers,504XIGrabModifiers *modifiers_inout505);506507extern int XIGrabKeycode(508Display* display,509int deviceid,510int keycode,511Window grab_window,512int grab_mode,513int paired_device_mode,514int owner_events,515XIEventMask *mask,516int num_modifiers,517XIGrabModifiers *modifiers_inout518);519520extern int XIGrabEnter(521Display* display,522int deviceid,523Window grab_window,524Cursor cursor,525int grab_mode,526int paired_device_mode,527int owner_events,528XIEventMask *mask,529int num_modifiers,530XIGrabModifiers *modifiers_inout531);532533extern int XIGrabFocusIn(534Display* display,535int deviceid,536Window grab_window,537int grab_mode,538int paired_device_mode,539int owner_events,540XIEventMask *mask,541int num_modifiers,542XIGrabModifiers *modifiers_inout543);544545extern int XIGrabTouchBegin(546Display* display,547int deviceid,548Window grab_window,549int owner_events,550XIEventMask *mask,551int num_modifiers,552XIGrabModifiers *modifiers_inout553);554555extern Status XIUngrabButton(556Display* display,557int deviceid,558int button,559Window grab_window,560int num_modifiers,561XIGrabModifiers *modifiers562);563564extern Status XIUngrabKeycode(565Display* display,566int deviceid,567int keycode,568Window grab_window,569int num_modifiers,570XIGrabModifiers *modifiers571);572573extern Status XIUngrabEnter(574Display* display,575int deviceid,576Window grab_window,577int num_modifiers,578XIGrabModifiers *modifiers579);580581extern Status XIUngrabFocusIn(582Display* display,583int deviceid,584Window grab_window,585int num_modifiers,586XIGrabModifiers *modifiers587);588589extern Status XIUngrabTouchBegin(590Display* display,591int deviceid,592Window grab_window,593int num_modifiers,594XIGrabModifiers *modifiers595);596597extern Atom *XIListProperties(598Display* display,599int deviceid,600int *num_props_return601);602603extern void XIChangeProperty(604Display* display,605int deviceid,606Atom property,607Atom type,608int format,609int mode,610unsigned char *data,611int num_items612);613614extern void615XIDeleteProperty(616Display* display,617int deviceid,618Atom property619);620621extern Status622XIGetProperty(623Display* display,624int deviceid,625Atom property,626long offset,627long length,628Bool delete_property,629Atom type,630Atom *type_return,631int *format_return,632unsigned long *num_items_return,633unsigned long *bytes_after_return,634unsigned char **data635);636637extern void638XIBarrierReleasePointers(639Display* display,640XIBarrierReleasePointerInfo *barriers,641int num_barriers642);643644extern void645XIBarrierReleasePointer(646Display* display,647int deviceid,648PointerBarrier barrier,649BarrierEventID eventid650);651652extern void XIFreeDeviceInfo(XIDeviceInfo *info);653654_XFUNCPROTOEND655656#endif /* XINPUT2_H */657658659