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