1XGRABDEVICEKEY(3) XGRABDEVICEKEY(3)
2
3
4
6 XGrabDeviceKey, XUngrabDeviceKey - grab/ungrab extension input device
7 Keys
8
10 #include <X11/extensions/XInput.h>
11
12 int XGrabDeviceKey( Display *display,
13 XDevice *device,
14 unsigned int key,
15 unsigned int modifiers,
16 XDevice *modifier_device,
17 Window grab_window,
18 Bool owner_events,
19 unsigned int event_count,
20 XEventClass *event_list,
21 int this_device_mode,
22 int other_devices_mode);
23
24 int XUngrabDeviceKey( Display *display,
25 XDevice *device,
26 unsigned int key,
27 unsigned int modifiers,
28 XDevice *modifier_device,
29 Window grab_window);
30
31 display
32 Specifies the connection to the X server.
33
34 device
35 Specifies the device that is to be grabbed or released.
36
37 Key
38 Specifies the device Key that is to be grabbed released
39 or AnyKey.
40
41 modifiers
42 Specifies the set of keymasks or AnyModifier. The mask is
43 the bitwise inclusive OR of the valid keymask bits. Valid
44 bits are: ShiftMask, LockMask, ControlMask, Mod1Mask,
45 Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask.
46
47 modifier_device
48 Specifies the device whose modifiers are to be used. If
49 a modifier_device of NULL is specified, the X keyboard
50 will be used as the modifier_device.
51
52 grab_window
53 Specifies the grab window.
54
55 owner_events
56 Specifies a Boolean value that indicates whether the
57 device events are to be reported as usual or reported
58 with respect to the grab window if selected by the event
59 list.
60
61 event_count
62 Specifies the number of event classes in the event list.
63
64 event_list
65 Specifies which device events are reported to the
66 client.
67
68 this_device_mode
69 Specifies further processing of events from this
70 device. You can pass GrabModeSync or GrabModeAsync.
71
72 other_devices_mode
73 Specifies further processing of events from other
74 devices. You can pass GrabModeSync or GrabModeAsync.
75
77 The XGrabDeviceKey request establishes a passive grab. In the
78 future, the device is actively grabbed (as for XGrabDevice, the
79 last-device-grab time is set to the time at which the Key was
80 pressed (as transmitted in the DeviceKeyPress event), and the
81 DeviceKeyPress event is reported if all of the following
82 conditions are true:
83 * The device is not grabbed, and the specified key is
84 logically pressed when the specified modifier keys are
85 logically down, and no other keys or modifier keys are
86 logically down.
87 * The grab_window is an ancestor (or is) the focus window OR
88 the grab window is a descendant of the focus window and
89 contains the device.
90 * The confine_to window (if any) is viewable.
91 * A passive grab on the same key/modifier combination does
92 not exist on any ancestor of grab_window.
93
94 The interpretation of the remaining arguments is as for
95 XGrabDevice. The active grab is terminated automatically when
96 the logical state of the device has the specified key released.
97
98 Note that the logical state of a device (as seen by means of
99 the X protocol ) may lag the physical state if device event
100 processing is frozen.
101
102 If the key is not AnyKey, it must be in the range specified by
103 min_keycode and max_keycode as returned by the
104 XListInputDevices request. Otherwise, a BadValue error results.
105
106 This request overrides all previous grabs by the same client on
107 the same Key/modifier combinations on the same window. A
108 modifier of AnyModifier is equivalent to issuing the grab
109 request for all possible modifier combinations (including the
110 combination of no modifiers). It is not required that all
111 modifiers specified have currently assigned KeyCodes. A key of
112 AnyKey is equivalent to issuing the request for all possible
113 keys. Otherwise, it is not required that the specified key
114 currently be assigned to a physical Key.
115
116 If a modifier_device of NULL is specified, the X keyboard will
117 be used as the modifier_device.
118
119 If some other client has already issued a XGrabDeviceKey with
120 the same Key/modifier combination on the same window, a
121 BadAccess error results. When using AnyModifier or AnyKey, the
122 request fails completely, and a BadAccess error results (no
123 grabs are established) if there is a conflicting grab for any
124 combination. XGrabDeviceKey has no effect on an active grab.
125
126 XGrabDeviceKey can generate BadAccess, BadClass, BadDevice,
127 BadMatch, BadValue, and BadWindow errors. It returns Success on
128 successful completion of the request.
129
130 The XUngrabDeviceKey request releases the passive grab for a
131 key/modifier combination on the specified window if it was
132 grabbed by this client. A modifier of AnyModifier is equivalent
133 to issuing the ungrab request for all possible modifier
134 combinations, including the combination of no modifiers. A Key
135 of AnyKey is equivalent to issuing the request for all possible
136 Keys. XUngrabDeviceKey has no effect on an active grab.
137
138 If a modifier_device of NULL is specified, the X keyboard will
139 be used as the modifier_device.
140
141 XUngrabDeviceKey can generate BadDevice, BadMatch, BadValue and
142 BadWindow errors.
143
145 BadDevice
146 An invalid device was specified. The specified device
147 does not exist or has not been opened by this client via
148 XOpenInputDevice. This error may also occur if the
149 specified device is the X keyboard or X pointer device.
150
151 BadMatch
152 This error may occur if an XGrabDeviceKey request was
153 made specifying a device that has no keys, or a modifier
154 device that has no keys.
155
156 BadValue
157 Some numeric value falls outside the range of values
158 accepted by the request. Unless a specific range is
159 specified for an argument, the full range defined by the
160 argument's type is accepted. Any argument defined as a
161 set of alternatives can generate this error.
162
163 BadWindow
164 A value for a Window argument does not name a defined
165 Window.
166
168 XAllowDeviceEvents(3), XGrabDevice(3), XGrabDeviceButton(3)
169
170
171
172 09/15/2021 XGRABDEVICEKEY(3)