1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
.\"
.\" $XFree86: xc/doc/man/Xi/XOpenDev.man,v 1.2 2001/01/27 18:20:21 dawes Exp $
.\"
.\"
.\" Copyright ([\d,\s]*) by Hewlett-Packard Company, Ardent Computer,
.\"
.\" Permission to use, copy, modify, distribute, and sell this documentation
.\" for any purpose and without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\" Ardent, and Hewlett-Packard make no representations about the
.\" suitability for any purpose of the information in this document. It is
.\" provided \`\`as is'' without express or implied warranty.
.\"
.\" $Xorg: XOpenDev.man,v 1.3 2000/08/17 19:41:56 cpqbld Exp $
.ds xL Programming with Xlib
.TH XOpenDevice 3X11 __xorgversion__ "X FUNCTIONS"
.SH NAME
XOpenDevice, XCloseDevice \- open or close an extension input device
.SH SYNTAX
.HP
XDevice *XOpenDevice\^(\^Display *\fIdisplay\fP\^, XID \fIdevice_id\fP\^);
.HP
XCloseDevice\^(\^Display *\fIdisplay\fP\^, XDevice *\fIdevice\fP\^);
.fi
\fP
.SH ARGUMENTS
.TP 12
.I display
Specifies the connection to the X server.
.TP 12
.I device_id
Specifies the id of the device to be opened
.TP 12
.I device
Specifies the device to be closed
.SH DESCRIPTION
The \fIXOpenDevice\fP
request makes an input device accessible to a client through input extension
protocol requests. If successful, it returns a pointer to an \fBXDevice\fP
structure.
.LP
The \fIXCloseDevice\fP request makes an input device inaccessible to a
client through input extension protocol requests. Before terminating,
and client that has opened input devices through the input extension
should close them via \fICloseDevice\fP.
.LP
When a client makes an \fIXCloseDevice\fP request,
any active grabs that the client has on the device are
released. Any event selections that the client has are deleted, as well as
any passive grabs. If the requesting client is the last client accessing
the device, the server may disable all access by X to the device.
.LP
\fIXOpenDevice\fP and \fIXCloseDevice\fP can generate a \fIBadDevice\fP
error.
.SH STRUCTURES
The
\fIXDevice\fP structure returned by \fIXOpenDevice\fP contains:
.nf
typedef struct {
XID device_id;
int num_classes;
XInputClassInfo *classes;
} XDevice;
.fi
.LP
The classes field is a pointer to an array of XInputClassInfo structures.
Each element of this array contains an event type base for a class of input
supported by the specified device. The num_classes field indicates the
number of elements in the classes array.
.LP
The
\fIXInputClassInfo\fP
structure contains:
.LP
.nf
typedef struct {
unsigned char input_class;
unsigned char event_type_base;
} XInputClassInfo;
.fi
.LP
The input_class field identifies one class of input
supported by the device. Defined types include \fIKeyClass\fP,
\fIButtonClass\fP, \fIValuatorClass\fP, \fIProximityClass\fP,
\fIFeedbackClass\fP, \fIFocusClass\fP, and \fIOtherClass\fP.
The event_type_base identifies the event type of the first event in that class.
.LP
The information contained in the \fIXInputClassInfo\fP structure is used
by macros to obtain the event classes that clients use in making
\fIXSelectExtensionEvent\fP requests. Currently defined macros include
\fIDeviceKeyPress\fP, \fIDeviceKeyRelease\fP, \fIDeviceButtonPress\fP,
\fIDeviceButtonRelese\fP, \fIDeviceMotionNotify\fP, \fIDeviceFocusIn\fP,
\fIDeviceFocusOut\fP, \fIProximityIn\fP, \fIProximityOut\fP,
\fIDeviceStateNotify\fP, \fIDeviceMappiingNotify\fP,
\fIChangeDeviceNotify\fP, \fIDevicePointerMotionHint\fP,
\fIDeviceButton1Motion\fP, \fIDeviceButton2Motion\fP, \fIDeviceButton3Motion\fP,
\fIDeviceButton4Motion\fP, \fIDeviceButton5Motion\fP, \fIDeviceButtonMotion\fP,
\fIDeviceOwnerGrabButton\fP, \fIDeviceButtonPressGrab\fP, and
\fINoExtensionEvent\fP.
.LP
To obtain the proper event class for a particular device, one of the above
macros is invoked using the \fIXDevice\fP structure for that device. For
example,
.LP
.nf
DeviceKeyPress (*device, type, eventclass);
.fi
.LP
returns the \fIDeviceKeyPress\fP event type and the eventclass for
\fIDeviceKeyPress\fP events from the specified device.
.LP
This \fIeventclass\fP can then be used in an \fIXSelectExtensionEvent\fP
request to ask the server to send \fIDeviceKeyPress\fP events from this device.
When a selected event is received via \fIXNextEvent\fP, the \fItype\fP can be
used for comparison with the type in the event.
.SH DIAGNOSTICS
.TP 12
\fIBadDevice\fP
An invalid device was specified. The specified device does not exist,
or is the X keyboard or X pointer. This error may
also occur if some other client has caused the specified device to become
the X keyboard or X pointer device via the \fIXChangeKeyboardDevice\fP or
\fIXChangePointerDevice\fP requests.
.SH "SEE ALSO"
.br
\fI\*(xL\fP
|