| 1 |
'\" t |
| 2 |
.\" Title: xopendevice |
| 3 |
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] |
| 4 |
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> |
| 5 |
.\" Date: 09/05/2024 |
| 6 |
.\" Manual: \ \& |
| 7 |
.\" Source: \ \& |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "XOPENDEVICE" "libmansuffix" "09/05/2024" "\ \&" "\ \&" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
XOpenDevice, XCloseDevice \- open or close an extension input device |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
.nf |
| 35 |
#include <X11/extensions/XInput\&.h> |
| 36 |
.fi |
| 37 |
.sp |
| 38 |
.nf |
| 39 |
XDevice *XOpenDevice( Display *display, |
| 40 |
XID device_id); |
| 41 |
.fi |
| 42 |
.sp |
| 43 |
.nf |
| 44 |
XCloseDevice( Display *display, |
| 45 |
XDevice *device); |
| 46 |
.fi |
| 47 |
.sp |
| 48 |
.nf |
| 49 |
display |
| 50 |
Specifies the connection to the X server\&. |
| 51 |
.fi |
| 52 |
.sp |
| 53 |
.nf |
| 54 |
device_id |
| 55 |
Specifies the id of the device to be opened |
| 56 |
.fi |
| 57 |
.sp |
| 58 |
.nf |
| 59 |
device |
| 60 |
Specifies the device to be closed |
| 61 |
.fi |
| 62 |
.SH "DESCRIPTION" |
| 63 |
.sp |
| 64 |
.if n \{\ |
| 65 |
.RS 4 |
| 66 |
.\} |
| 67 |
.nf |
| 68 |
The XOpenDevice request makes an input device accessible to a |
| 69 |
client through input extension protocol requests\&. If |
| 70 |
successful, it returns a pointer to an XDevice structure\&. |
| 71 |
.fi |
| 72 |
.if n \{\ |
| 73 |
.RE |
| 74 |
.\} |
| 75 |
.sp |
| 76 |
.if n \{\ |
| 77 |
.RS 4 |
| 78 |
.\} |
| 79 |
.nf |
| 80 |
The XCloseDevice request makes an input device inaccessible to |
| 81 |
a client through input extension protocol requests\&. Before |
| 82 |
terminating, and client that has opened input devices through |
| 83 |
the input extension should close them via CloseDevice\&. |
| 84 |
.fi |
| 85 |
.if n \{\ |
| 86 |
.RE |
| 87 |
.\} |
| 88 |
.sp |
| 89 |
.if n \{\ |
| 90 |
.RS 4 |
| 91 |
.\} |
| 92 |
.nf |
| 93 |
When a client makes an XCloseDevice request, any active grabs |
| 94 |
that the client has on the device are released\&. Any event |
| 95 |
selections that the client has are deleted, as well as any |
| 96 |
passive grabs\&. If the requesting client is the last client |
| 97 |
accessing the device, the server may disable all access by X to |
| 98 |
the device\&. |
| 99 |
.fi |
| 100 |
.if n \{\ |
| 101 |
.RE |
| 102 |
.\} |
| 103 |
.sp |
| 104 |
.if n \{\ |
| 105 |
.RS 4 |
| 106 |
.\} |
| 107 |
.nf |
| 108 |
XOpenDevice and XCloseDevice can generate a BadDevice error\&. |
| 109 |
.fi |
| 110 |
.if n \{\ |
| 111 |
.RE |
| 112 |
.\} |
| 113 |
.sp |
| 114 |
Structures |
| 115 |
.sp |
| 116 |
.if n \{\ |
| 117 |
.RS 4 |
| 118 |
.\} |
| 119 |
.nf |
| 120 |
The XDevice structure returned by XOpenDevice contains: |
| 121 |
typedef struct { |
| 122 |
XID device_id; |
| 123 |
int num_classes; |
| 124 |
XInputClassInfo *classes; |
| 125 |
} XDevice; |
| 126 |
.fi |
| 127 |
.if n \{\ |
| 128 |
.RE |
| 129 |
.\} |
| 130 |
.sp |
| 131 |
.if n \{\ |
| 132 |
.RS 4 |
| 133 |
.\} |
| 134 |
.nf |
| 135 |
The classes field is a pointer to an array of XInputClassInfo |
| 136 |
structures\&. Each element of this array contains an event type |
| 137 |
base for a class of input supported by the specified device\&. |
| 138 |
The num_classes field indicates the number of elements in the |
| 139 |
classes array\&. |
| 140 |
.fi |
| 141 |
.if n \{\ |
| 142 |
.RE |
| 143 |
.\} |
| 144 |
.sp |
| 145 |
.if n \{\ |
| 146 |
.RS 4 |
| 147 |
.\} |
| 148 |
.nf |
| 149 |
The XInputClassInfo structure contains: |
| 150 |
.fi |
| 151 |
.if n \{\ |
| 152 |
.RE |
| 153 |
.\} |
| 154 |
.sp |
| 155 |
.if n \{\ |
| 156 |
.RS 4 |
| 157 |
.\} |
| 158 |
.nf |
| 159 |
typedef struct { |
| 160 |
unsigned char input_class; |
| 161 |
unsigned char event_type_base; |
| 162 |
} XInputClassInfo; |
| 163 |
.fi |
| 164 |
.if n \{\ |
| 165 |
.RE |
| 166 |
.\} |
| 167 |
.sp |
| 168 |
.if n \{\ |
| 169 |
.RS 4 |
| 170 |
.\} |
| 171 |
.nf |
| 172 |
The input_class field identifies one class of input supported |
| 173 |
by the device\&. Defined types include KeyClass, ButtonClass, |
| 174 |
ValuatorClass, ProximityClass, FeedbackClass, FocusClass, and |
| 175 |
OtherClass\&. The event_type_base identifies the event type of |
| 176 |
the first event in that class\&. |
| 177 |
.fi |
| 178 |
.if n \{\ |
| 179 |
.RE |
| 180 |
.\} |
| 181 |
.sp |
| 182 |
.if n \{\ |
| 183 |
.RS 4 |
| 184 |
.\} |
| 185 |
.nf |
| 186 |
The information contained in the XInputClassInfo structure is |
| 187 |
used by macros to obtain the event classes that clients use in |
| 188 |
making XSelectExtensionEvent requests\&. Currently defined macros |
| 189 |
include DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress, |
| 190 |
DeviceButtonRelease, DeviceMotionNotify, DeviceFocusIn, |
| 191 |
DeviceFocusOut, ProximityIn, ProximityOut, DeviceStateNotify, |
| 192 |
DeviceMappingNotify, ChangeDeviceNotify, |
| 193 |
DevicePointerMotionHint, DeviceButton1Motion, |
| 194 |
DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion, |
| 195 |
DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton, |
| 196 |
DeviceButtonPressGrab, and NoExtensionEvent\&. |
| 197 |
.fi |
| 198 |
.if n \{\ |
| 199 |
.RE |
| 200 |
.\} |
| 201 |
.sp |
| 202 |
.if n \{\ |
| 203 |
.RS 4 |
| 204 |
.\} |
| 205 |
.nf |
| 206 |
To obtain the proper event class for a particular device, one |
| 207 |
of the above macros is invoked using the XDevice structure for |
| 208 |
that device\&. For example, |
| 209 |
DeviceKeyPress (*device, type, eventclass); |
| 210 |
.fi |
| 211 |
.if n \{\ |
| 212 |
.RE |
| 213 |
.\} |
| 214 |
.sp |
| 215 |
.if n \{\ |
| 216 |
.RS 4 |
| 217 |
.\} |
| 218 |
.nf |
| 219 |
returns the DeviceKeyPress event type and the eventclass for |
| 220 |
DeviceKeyPress events from the specified device\&. |
| 221 |
.fi |
| 222 |
.if n \{\ |
| 223 |
.RE |
| 224 |
.\} |
| 225 |
.sp |
| 226 |
.if n \{\ |
| 227 |
.RS 4 |
| 228 |
.\} |
| 229 |
.nf |
| 230 |
This eventclass can then be used in an XSelectExtensionEvent |
| 231 |
request to ask the server to send DeviceKeyPress events from |
| 232 |
this device\&. When a selected event is received via XNextEvent, |
| 233 |
the type can be used for comparison with the type in the event\&. |
| 234 |
.fi |
| 235 |
.if n \{\ |
| 236 |
.RE |
| 237 |
.\} |
| 238 |
.SH "DIAGNOSTICS" |
| 239 |
.sp |
| 240 |
.if n \{\ |
| 241 |
.RS 4 |
| 242 |
.\} |
| 243 |
.nf |
| 244 |
BadDevice |
| 245 |
An invalid device was specified\&. The specified device |
| 246 |
does not exist, or is the X keyboard or X pointer\&. This |
| 247 |
error may also occur if some other client has caused the |
| 248 |
specified device to become the X keyboard or X pointer |
| 249 |
device via the XChangeKeyboardDevice or |
| 250 |
XChangePointerDevice requests\&. |
| 251 |
.fi |
| 252 |
.if n \{\ |
| 253 |
.RE |
| 254 |
.\} |