1XOPENDEVICE(libmansuffix) 2========================= 3 4NAME 5---- 6 7 XOpenDevice, XCloseDevice - open or close an extension input 8 device 9 10SYNOPSIS 11-------- 12 13 #include <X11/extensions/XInput.h> 14 15 XDevice *XOpenDevice( Display *display, 16 XID device_id); 17 18 XCloseDevice( Display *display, 19 XDevice *device); 20 21 display 22 Specifies the connection to the X server. 23 24 device_id 25 Specifies the id of the device to be opened 26 27 device 28 Specifies the device to be closed 29 30DESCRIPTION 31----------- 32 33 The XOpenDevice request makes an input device accessible to a 34 client through input extension protocol requests. If 35 successful, it returns a pointer to an XDevice structure. 36 37 The XCloseDevice request makes an input device inaccessible to 38 a client through input extension protocol requests. Before 39 terminating, and client that has opened input devices through 40 the input extension should close them via CloseDevice. 41 42 When a client makes an XCloseDevice request, any active grabs 43 that the client has on the device are released. Any event 44 selections that the client has are deleted, as well as any 45 passive grabs. If the requesting client is the last client 46 accessing the device, the server may disable all access by X to 47 the device. 48 49 XOpenDevice and XCloseDevice can generate a BadDevice error. 50 51Structures 52 53 The XDevice structure returned by XOpenDevice contains: 54 typedef struct { 55 XID device_id; 56 int num_classes; 57 XInputClassInfo *classes; 58 } XDevice; 59 60 The classes field is a pointer to an array of XInputClassInfo 61 structures. Each element of this array contains an event type 62 base for a class of input supported by the specified device. 63 The num_classes field indicates the number of elements in the 64 classes array. 65 66 The XInputClassInfo structure contains: 67 68 typedef struct { 69 unsigned char input_class; 70 unsigned char event_type_base; 71 } XInputClassInfo; 72 73 The input_class field identifies one class of input supported 74 by the device. Defined types include KeyClass, ButtonClass, 75 ValuatorClass, ProximityClass, FeedbackClass, FocusClass, and 76 OtherClass. The event_type_base identifies the event type of 77 the first event in that class. 78 79 The information contained in the XInputClassInfo structure is 80 used by macros to obtain the event classes that clients use in 81 making XSelectExtensionEvent requests. Currently defined macros 82 include DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress, 83 DeviceButtonRelease, DeviceMotionNotify, DeviceFocusIn, 84 DeviceFocusOut, ProximityIn, ProximityOut, DeviceStateNotify, 85 DeviceMappingNotify, ChangeDeviceNotify, 86 DevicePointerMotionHint, DeviceButton1Motion, 87 DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion, 88 DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton, 89 DeviceButtonPressGrab, and NoExtensionEvent. 90 91 To obtain the proper event class for a particular device, one 92 of the above macros is invoked using the XDevice structure for 93 that device. For example, 94 DeviceKeyPress (*device, type, eventclass); 95 96 returns the DeviceKeyPress event type and the eventclass for 97 DeviceKeyPress events from the specified device. 98 99 This eventclass can then be used in an XSelectExtensionEvent 100 request to ask the server to send DeviceKeyPress events from 101 this device. When a selected event is received via XNextEvent, 102 the type can be used for comparison with the type in the event. 103 104DIAGNOSTICS 105----------- 106 107 BadDevice 108 An invalid device was specified. The specified device 109 does not exist, or is the X keyboard or X pointer. This 110 error may also occur if some other client has caused the 111 specified device to become the X keyboard or X pointer 112 device via the XChangeKeyboardDevice or 113 XChangePointerDevice requests. 114