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