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