1XIQUERYDEVICE(3) [FIXME: manual] XIQUERYDEVICE(3)
2
3
4
6 XIQueryDevice, XIFreeDeviceInfo - get information about devices.
7
9 #include <X11/extensions/XInput2.h>
10
11 XIDeviceInfo* XIQueryPointer( Display *display,
12 int deviceid,
13 int *ndevices_return);
14
15 XIFreeDeviceInfo( XIDeviceInfo *info);
16
17 deviceid
18 Specifies the device to query or XIAllDevices or
19 XIAllMasterDevices.
20
21 display
22 Specifies the connection to the X server.
23
24 ndevices_return
25 Returns the number of devices returned.
26
27 info
28 A list of device XIDeviceInfo structs to be freed.
29
31 The XIQueryDevice returns information about one or more input
32 devices. If the deviceid specifies a device, ndevices_return is
33 1 and the returned information describes only the requested
34 device. If deviceid is XIAllDevices or XIAllMasterDevices,
35 ndevices_return is the number of devices or master devices,
36 respectively, and the returned information represents all
37 devices or all master devices, respectively.
38
39 To free the XIDeviceInfo array returned by XIQueryDevice, use
40 XIFreeDeviceInfo.
41
42 For each input device requested, the XIQueryDevice returns an
43 XIDeviceInfo structure. Each structure contains information
44 about the capabilities of one input device available to the
45 server.
46
47 typedef struct
48 {
49 int deviceid;
50 char *name;
51 int use;
52 int attachment;
53 Bool enabled;
54 int num_classes;
55 XIAnyClassInfo **classes;
56 } XIDeviceInfo;
57
58 The deviceid is the numeric unique id of the device. A deviceid
59 is unique for the life-time of a device but a server may re-use
60 the id once a device has been removed.
61
62 The name points to a null-terminated string specifying the
63 identifier of the device.
64
65 The use and attachment fields specify the type of the device
66 and the current attachment or pairing.
67 - If use is XIMasterPointer, the device is a master pointer and
68 attachment specifies the deviceid of the paired master
69 keyboard.
70 - If use is XIMasterKeyboard, the device is a master keyboard,
71 and the attachment field specifies the paired master pointer.
72 - If use is XISlavePointer, the device is a slave device and
73 currently attached to the master pointer specified in
74 attachement.
75 - If use is XISlaveKeyboard, the device is a slave device an
76 currently attached to the master keyboard specified in
77 attachment.
78 - If use is XIFloatingSlave, the device is a slave device
79 currently not attached to any master device. The value of the
80 attachment field for floating slave devices is undefined.
81
82 The enabled field specifies if the device is currently enabled
83 and can send events. Disabled devices will not send events.
84
85 The num_classes field specifies the number of input classes
86 pointed to by classes. The first two fields of all input
87 classes are identical.
88
89 typedef struct
90 {
91 int type;
92 int sourceid;
93 } XIAnyClassInfo;
94
95 The type field specifies the type of the input class.
96 Currently, the following types are defined:
97 XIKeyClass, XIButtonClass, XIValuatorClass
98
99 In the future, additional types may be added. Clients are
100 required to ignore unknown input classes.
101
102 The sourceid is the deviceid this class originated from. For
103 master devices, the sourceid is typically the id of the slave
104 device currently sending events. For slave devices, the
105 sourceid is typically the device´s id.
106
107 A device may have zero or one XIButtonClass, denoting the
108 device´s capability to send button events.
109
110 typedef struct {
111 int mask_len;
112 unsigned char *mask;
113 } XIButtonState;
114
115 typedef struct
116 {
117 int type;
118 int sourceid;
119 int num_buttons;
120 Atom *labels;
121 XIButtonState state;
122 } XIButtonClassInfo;
123
124 The num_buttons field specifies the number of buttons available
125 on this device. A device that has an XIButtonClass must have at
126 least one button.
127
128 labels is a list of num_buttons Atoms specifying the button
129 labels for this device. If the label is not None, then the
130 label specifies the type of button in physical device order
131 (i.e. as the buttons are numbered on the physical input
132 device).
133
134 The state is the current button state as seen by clients (i.e.
135 after button mapping is applied). The mask_len field specifies
136 the length of mask in bytes. For each button on the device, the
137 respective bit in mask is set if the button is currently
138 logically down.
139
140 A device may have zero or one XIKeyClass, denoting the device´s
141 capability to send key events.
142
143 typedef struct
144 {
145 int type;
146 int sourceid;
147 int num_keycodes;
148 int *keycodes;
149 } XIKeyClassInfo;
150
151 The num_keycodes field specifies the number of keycodes
152 available on this device. A device that has an XIKeyClass must
153 have at least one keycode.
154
155 keycodes is a list of num_keycodes keycodes the device may
156 send.
157
158 A device may have zero or more XIValuatorClass, denoting the
159 device´s capability to send coordinates.
160
161 typedef struct
162 {
163 int type;
164 int sourceid;
165 int number;
166 Atom label;
167 double min;
168 double max;
169 double value;
170 int resolution;
171 int mode;
172 } XIValuatorInfo;
173
174 The number field specifies the number of the axis on the
175 physical device.
176
177 If the label field is not None, the value of label is an Atom
178 describing the axis.
179
180 min and max are the minimum and maximum values allowed on this
181 axis. If both are zero, no minumum or maximum values are set on
182 this device. value is the current value of this axis.
183
184 The resolution field specifies the resolution of the device in
185 units/m.
186
187 The mode specifies the mode of this axis. If the mode is
188 XIModeAbsolute this axis sends absolute coordinates. If the
189 mode is XIModeRelative, this device sends relative coordinates.
190
191 XIQueryDevice can generate a BadDevice error.
192
193 XIFreeDeviceInfo frees the information returned by
194 XIQueryDevice.
195
197 BadDevice
198 An invalid device was specified. The device does not
199 exist or is not a pointer device.
200
201
202
203[FIXME: source] 08/04/2010 XIQUERYDEVICE(3)