1XGRABDEVICE(3) XGRABDEVICE(3)
2
3
4
6 XGrabDevice, XUngrabDevice - grab/release the specified extension
7 device
8
10 #include <X11/extensions/XInput.h>
11
12 int XGrabDevice( Display *display,
13 XDevice* device,
14 Window grab_window,
15 Bool owner_events,
16 int event_count,
17 XEventClass *event_list,
18 int this_device_mode,
19 int other_devices_mode,
20 Time time);
21
22 int XUngrabDevice( Display *display,
23 XDevice *device,
24 Time time);
25
26 display
27 Specifies the connection to the X server.
28
29 device
30 Specifies the device to be grabbed or released.
31
32 grab_window
33 Specifies the id of a window to be associated with the
34 device.
35
36 owner_events
37 Specifies a Boolean value that indicates whether
38 the events from the device are to be reported as usual or
39 reported with respect to the grab window if selected by
40 the event list.
41
42 event_count
43 Specifies the number of elements in the event_list
44 array.
45
46 event_list
47 Specifies a pointer to a list of event classes that
48 indicates which events the client wishes to receive.
49 These event classes must have been obtained specifying
50 the device being grabbed.
51
52 this_device_mode
53 Specifies further processing of events from this
54 device. You can pass GrabModeSync or GrabModeAsync.
55
56 other_devices_mode
57 Specifies further processing of events from other
58 devices. You can pass GrabModeSync or GrabModeAsync.
59
60 time
61 Specifies the time. You can pass either a timestamp or
62 CurrentTime.
63
65 The XGrabDevice request actively grabs control of the device
66 and generates DeviceFocusIn and DeviceFocusOut events. Further
67 device events are reported only to the grabbing
68 client. XGrabDevice overrides any active device grab by this
69 client. event_list is a pointer to a list of event classes.
70 This list indicates which events the client wishes to receive
71 while the grab is active. If owner_events is False, all
72 generated device events are reported with respect to
73 grab_window if selected. If owner_events is True and if a
74 generated device event would normally be reported to this
75 client, it is reported normally; otherwise, the event is
76 reported with respect to the grab_window, and is only reported
77 if specified in the event_list.
78
79 If the this_device_mode argument is GrabModeAsync, device event
80 processing continues as usual. If the device is currently
81 frozen by this client, then processing of device events is
82 resumed. If the this_device_mode argument is GrabModeSync, the
83 state of the device (as seen by client applications) appears to
84 freeze, and the X server generates no further device events
85 until the grabbing client issues a releasing XAllowDeviceEvents
86 call or until the device grab is released. Actual device
87 changes are not lost while the device is frozen; they are
88 simply queued in the server for later processing.
89
90 If other_devices_mode is GrabModeAsync, processing of events
91 from other devices is unaffected by activation of the grab. If
92 other_devices_mode is GrabModeSync, the state of all devices
93 except the grabbed device (as seen by client applications)
94 appears to freeze, and the X server generates no further events
95 from those devices until the grabbing client issues a releasing
96 XAllowDeviceEvents call or until the device grab is released.
97 Actual events are not lost while the devices are frozen; they
98 are simply queued in the server for later processing.
99
100 If the device is actively grabbed by some other client,
101 XGrabDevice fails and returns AlreadyGrabbed. If grab_window is
102 not viewable, it fails and returns GrabNotViewable. If the
103 device is frozen by an active grab of another client, it fails
104 and returns GrabFrozen. If the specified time is earlier than
105 the last-device-grab time or later than the current X server
106 time, it fails and returns GrabInvalidTime. Otherwise, the
107 last-device-grab time is set to the specified time
108 (CurrentTime is replaced by the current X server time).
109
110 If a grabbed device is closed by a client while an active grab
111 by that client is in effect, the active grab is released. If
112 the device is frozen only by an active grab of the requesting
113 client, it is thawed.
114
115 XGrabDevice can generate BadClass, BadDevice, BadValue, and
116 BadWindow errors.
117
118 The XUngrabDevice request releases the device and any queued
119 events if this client has it actively grabbed from either
120 XGrabDevice or XGrabDeviceKey. If other devices are frozen by
121 the grab, XUngrabDevice thaws them. XUngrabDevice does not
122 release the device and any queued events if the specified time
123 is earlier than the last-device-grab time or is later than the
124 current X server time. It also generates DeviceFocusIn and
125 DeviceFocusOut events. The X server automatically performs an
126 UngrabDevice request if the event window for an active device
127 grab becomes not viewable.
128
129 XUngrabDevice can generate a BadDevice error.
130
132 BadDevice
133 An invalid device was specified. The specified device
134 does not exist or has not been opened by this client via
135 XOpenInputDevice. This error may also occur if the
136 specified device is the X keyboard or X pointer device.
137
138 BadValue
139 Some numeric value falls outside the range of values
140 accepted by the request. Unless a specific range is
141 specified for an argument, the full range defined by the
142 argument's type is accepted. Any argument defined as a
143 set of alternatives can generate this error.
144
145 BadWindow
146 A value for a Window argument does not name a defined
147 Window.
148
150 XAllowDeviceEvents(3), XGrabDeviceButton(3), XGrabDeviceKey(3)
151
152
153
154 05/04/2023 XGRABDEVICE(3)