1 XOPENDEVICE(libmansuffix)
2 =========================
7 XOpenDevice, XCloseDevice - open or close an extension input
13 #include <X11/extensions/XInput.h>
15 XDevice *XOpenDevice( Display *display,
18 XCloseDevice( Display *display,
22 Specifies the connection to the X server.
25 Specifies the id of the device to be opened
28 Specifies the device to be closed
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.
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.
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
49 XOpenDevice and XCloseDevice can generate a BadDevice error.
53 The XDevice structure returned by XOpenDevice contains:
57 XInputClassInfo *classes;
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
66 The XInputClassInfo structure contains:
69 unsigned char input_class;
70 unsigned char event_type_base;
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.
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 DeviceButtonRelese, 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.
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);
96 returns the DeviceKeyPress event type and the eventclass for
97 DeviceKeyPress events from the specified device.
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.
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.