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