1XIGRABDEVICE(3) XIGRABDEVICE(3)
2
3
4
6 XIGrabDevice, XIUngrabDevice - grab or ungrab the device.
7
9 #include <X11/extensions/XInput2.h>
10
11 Status XIGrabDevice( Display *display,
12 int deviceid,
13 Window grab_window,
14 Time time,
15 Cursor cursor,
16 int grab_mode,
17 int paired_device_mode,
18 Bool owner_events,
19 XIEventMask *mask);
20
21 Status XIUngrabDevice( Display *display,
22 int deviceid,
23 Time time);
24
25 cursor
26 Specifies the cursor image to display for the duration
27 of the grab.
28
29 display
30 Specifies the connection to the X server.
31
32 deviceid
33 Specifies the device that should be grabbed or
34 ungrabbed.
35
36 grab_mode, paired_device_mode
37 The grab mode for this device and (if applicable) the
38 paired device.
39
40 grab_window
41 The grab window.
42
43 mask
44 Event mask.
45
46 owner_events
47 True if events are to be reported normally.
48
49 time
50 A valid timestamp or CurrentTime.
51
53 XIGrabDevice actively grabs control of the device. Further
54 device events are reported only to the grabbing client.
55 XIGrabDevice overrides any active device grab by this client.
56
57 If the device is an attached slave device, the device is
58 automatically detached from the master device and reattached to
59 the same master device when client ungrabs the device. If the
60 master device is removed while the device is floating as a
61 result of a grab, the device remains floating once the grab
62 deactivates.
63
64 If owner_events is False, all generated device events are
65 reported with respect to grab_window if selected. If
66 owner_events is True and if a generated device event would
67 normally be reported to this client, it is reported normally;
68 otherwise, the event is reported with respect to the
69 grab_window, and is only reported if specified in the event
70 mask.
71
72 If the grab_mode argument is XIGrabModeAsync, device event
73 processing continues as usual. If the device is currently
74 frozen by this client, then processing of device events is
75 resumed. If the grab_mode argument is XIGrabModeSync, the state
76 of the device (as seen by client applications) appears to
77 freeze, and the X server generates no further device events
78 until the grabbing client issues a releasing XIAllowEvents call
79 or until the device grab is released. Actual device changes are
80 not lost while the device is frozen; they are simply queued in
81 the server for later processing.
82
83 If paired_device_mode is XIGrabModeAsync, processing of events
84 from the paired master device is unaffected by activation of
85 the grab. If paired_device_mode is XIGrabModeSync, the state of
86 the paired master device (as seen by client applications)
87 appears to freeze, and the X server generates no further events
88 from this device until the grabbing client issues a releasing
89 XIAllowEvents call or until the device grab is released. Actual
90 events are not lost while the devices are frozen; they are
91 simply queued in the server for later processing. If the device
92 is a slave device paired_device_mode is ignored.
93
94 If the device is actively grabbed by some other client,
95 XIGrabDevice fails and returns AlreadyGrabbed. If grab_window
96 is not viewable, it fails and returns GrabNotViewable. If the
97 device is frozen by an active grab of another client, it fails
98 and returns GrabFrozen. If the specified time is earlier than
99 the last-device-grab time or later than the current X server
100 time, it fails and returns GrabInvalidTime. Otherwise, the
101 last-device-grab time is set to the specified time. CurrentTime
102 is replaced by the current X server time.
103
104 If cursor is not None this cursor is displayed until the client
105 calls XIUngrabDevice.
106
107 XIGrabDevice can generate BadDevice, BadValue, and BadWindow
108 errors.
109
110 The XIUngrabDevice request releases the device and any queued
111 events if this client has it actively grabbed from either
112 XIGrabDevice or XIGrabKey or XIGrabButton. If other devices are
113 frozen by the grab, XUngrabDevice thaws them. XUngrabDevice
114 does not release the device and any queued events if the
115 specified time is earlier than the last-device-grab time or is
116 later than the current X server time. The X server
117 automatically performs an XIUngrabDevice request if the event
118 window for an active device grab becomes not viewable.
119
120 XIUngrabDevice can generate a BadDevice error.
121
123 BadValue
124 A value is outside of the permitted range.
125
126 BadDevice
127 An invalid device was specified. The device does not
128 exist or is not a appropriate for the type of change.
129
130 BadMatch
131 The window is not viewable.
132
133 BadWindow
134 A value for a Window argument does not name a defined
135 Window.
136
138 The protocol headers for XI 2.0 did not provide
139 XIGrabModeAsync or XIGrabModeSync. Use GrabModeSync and
140 GrabModeAsync instead, respectively.
141
143 XIAllowEvents(3)
144
145
146
147 05/04/2023 XIGRABDEVICE(3)