| 1 |
'\" t |
| 2 |
.\" Title: xigrabbutton |
| 3 |
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] |
| 4 |
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> |
| 5 |
.\" Date: 09/05/2024 |
| 6 |
.\" Manual: \ \& |
| 7 |
.\" Source: \ \& |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "XIGRABBUTTON" "libmansuffix" "09/05/2024" "\ \&" "\ \&" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
XIGrabButton, XIUngrabButton, XIGrabKeycode, XIUngrabKeycode, XIGrabTouchBegin, XIUngrabTouchBegin, XIGrabPinchGestureBegin, XIUngrabPinchGestureBegin, XIGrabSwipeGestureBegin \- grab/ungrab buttons or keys |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
.nf |
| 35 |
#include <X11/extensions/XInput2\&.h> |
| 36 |
.fi |
| 37 |
.sp |
| 38 |
.nf |
| 39 |
int XIGrabButton( Display *display, |
| 40 |
int deviceid, |
| 41 |
int button, |
| 42 |
Window grab_window, |
| 43 |
Cursor cursor, |
| 44 |
int grab_mode, |
| 45 |
int paired_device_mode, |
| 46 |
Bool owner_events, |
| 47 |
XIEventMask *mask, |
| 48 |
int num_modifiers, |
| 49 |
XIGrabModifiers *modifiers_inout); |
| 50 |
.fi |
| 51 |
.sp |
| 52 |
.nf |
| 53 |
int XIUngrabButton( Display *display, |
| 54 |
int deviceid, |
| 55 |
int button, |
| 56 |
Window grab_window, |
| 57 |
int num_modifiers, |
| 58 |
XIGrabModifiers *modifiers); |
| 59 |
.fi |
| 60 |
.sp |
| 61 |
.nf |
| 62 |
int XIGrabKeycode( Display *display, |
| 63 |
int deviceid, |
| 64 |
int keycode, |
| 65 |
Window grab_window, |
| 66 |
int grab_mode, |
| 67 |
int paired_device_mode, |
| 68 |
Bool owner_events, |
| 69 |
XIEventMask *mask, |
| 70 |
int num_modifiers, |
| 71 |
XIGrabModifiers *modifiers_inout); |
| 72 |
.fi |
| 73 |
.sp |
| 74 |
.nf |
| 75 |
int XIUngrabKeycode( Display *display, |
| 76 |
int deviceid, |
| 77 |
int keycode, |
| 78 |
Window grab_window, |
| 79 |
int num_modifiers, |
| 80 |
XIGrabModifiers *modifiers); |
| 81 |
.fi |
| 82 |
.sp |
| 83 |
.nf |
| 84 |
int XIGrabTouchBegin( Display *display, |
| 85 |
int deviceid, |
| 86 |
Window grab_window, |
| 87 |
Bool owner_events, |
| 88 |
XIEventMask *mask, |
| 89 |
int num_modifiers, |
| 90 |
XIGrabModifiers *modifiers_inout); |
| 91 |
.fi |
| 92 |
.sp |
| 93 |
.nf |
| 94 |
int XIUngrabTouchBegin( Display *display, |
| 95 |
int deviceid, |
| 96 |
Window grab_window, |
| 97 |
int num_modifiers, |
| 98 |
XIGrabModifiers *modifiers); |
| 99 |
.fi |
| 100 |
.sp |
| 101 |
.nf |
| 102 |
int XIGrabPinchGestureBegin( Display* display, |
| 103 |
int deviceid, |
| 104 |
Window grab_window, |
| 105 |
int grab_mode, |
| 106 |
int paired_device_mode, |
| 107 |
int owner_events, |
| 108 |
XIEventMask *mask, |
| 109 |
int num_modifiers, |
| 110 |
XIGrabModifiers *modifiers_inout); |
| 111 |
.fi |
| 112 |
.sp |
| 113 |
.nf |
| 114 |
int XIUngrabPinchGestureBegin( Display* display, |
| 115 |
int deviceid, |
| 116 |
Window grab_window, |
| 117 |
int num_modifiers, |
| 118 |
XIGrabModifiers *modifiers); |
| 119 |
.fi |
| 120 |
.sp |
| 121 |
.nf |
| 122 |
int XIGrabSwipeGestureBegin( Display* display, |
| 123 |
int deviceid, |
| 124 |
Window grab_window, |
| 125 |
int grab_mode, |
| 126 |
int paired_device_mode, |
| 127 |
int owner_events, |
| 128 |
XIEventMask *mask, |
| 129 |
int num_modifiers, |
| 130 |
XIGrabModifiers *modifiers_inout); |
| 131 |
.fi |
| 132 |
.sp |
| 133 |
.nf |
| 134 |
int XIUngrabSwipeGestureBegin( Display* display, |
| 135 |
int deviceid, |
| 136 |
Window grab_window, |
| 137 |
int num_modifiers, |
| 138 |
XIGrabModifiers *modifiers); |
| 139 |
.fi |
| 140 |
.sp |
| 141 |
.nf |
| 142 |
display |
| 143 |
Specifies the connection to the X server\&. |
| 144 |
.fi |
| 145 |
.sp |
| 146 |
.nf |
| 147 |
device |
| 148 |
Specifies the device that is to be grabbed or released |
| 149 |
.fi |
| 150 |
.sp |
| 151 |
.nf |
| 152 |
button |
| 153 |
Specifies the device button that is to be grabbed or |
| 154 |
released or XIAnyButton\&. |
| 155 |
.fi |
| 156 |
.sp |
| 157 |
.nf |
| 158 |
keycode |
| 159 |
Specifies the keycode that is to be grabbed or released |
| 160 |
or XIAnyKeycode\&. |
| 161 |
.fi |
| 162 |
.sp |
| 163 |
.nf |
| 164 |
num_modifiers |
| 165 |
Number of elements in modifiers or modifiers_inout\&. |
| 166 |
.fi |
| 167 |
.sp |
| 168 |
.nf |
| 169 |
modifiers |
| 170 |
Specifies the set of latched and base modifiers or |
| 171 |
XIAnyModifier to ungrab\&. The data type is for |
| 172 |
consistency with the respective grab request and the |
| 173 |
status code of the XIGrabModifiers struct is ignored\&. |
| 174 |
.fi |
| 175 |
.sp |
| 176 |
.nf |
| 177 |
modifiers_inout |
| 178 |
Specifies the set of latched and base modifiers or |
| 179 |
XIAnyModifier to grab\&. Returns the modifiers that could |
| 180 |
not be grabbed and their error code\&. |
| 181 |
.fi |
| 182 |
.sp |
| 183 |
.nf |
| 184 |
grab_window |
| 185 |
Specifies the grab window\&. |
| 186 |
.fi |
| 187 |
.sp |
| 188 |
.nf |
| 189 |
owner_events |
| 190 |
Specifies a Boolean value that indicates whether the are |
| 191 |
to be reported as usual or reported with respect to the |
| 192 |
grab window\&. |
| 193 |
.fi |
| 194 |
.sp |
| 195 |
.nf |
| 196 |
mask |
| 197 |
Specifies the event mask\&. |
| 198 |
.fi |
| 199 |
.sp |
| 200 |
.nf |
| 201 |
grab_mode |
| 202 |
Specifies further processing of events from this device\&. |
| 203 |
You can pass XIGrabModeSync or XIGrabModeAsync\&. |
| 204 |
.fi |
| 205 |
.sp |
| 206 |
.nf |
| 207 |
paired_device_mode |
| 208 |
Specifies further processing of events from the paired |
| 209 |
master device\&. You can pass XIGrabModeSync or |
| 210 |
XIGrabModeAsync\&. If deviceid specifies a floating slave |
| 211 |
device, this parameter is ignored\&. |
| 212 |
.fi |
| 213 |
.SH "DESCRIPTION" |
| 214 |
.sp |
| 215 |
.if n \{\ |
| 216 |
.RS 4 |
| 217 |
.\} |
| 218 |
.nf |
| 219 |
XIGrabButton, XIGrabKeycode, XIGrabTouchBegin, XIGrabPinchGestureBegin, |
| 220 |
XIGrabSwipeTouchBegin establish a passive grab\&. |
| 221 |
The modifier device for a button grab is the paired master device |
| 222 |
if deviceid specifies a master pointer\&. Otherwise, the modifier |
| 223 |
device is the device specified with deviceid\&. In the future, |
| 224 |
the device is actively grabbed (as for XIGrabDevice, the |
| 225 |
last\-grab time is set to the time at which the button or keycode |
| 226 |
was pressed and the XI_ButtonPress or XI_KeyPress event is |
| 227 |
reported if all of the following conditions are true: |
| 228 |
* The device is not grabbed, and the specified button or |
| 229 |
keycode is logically pressed, a touch or a gesture event occurs when the |
| 230 |
specified modifier keys are logically down on the modifier device |
| 231 |
and no other buttons or modifier keys are logically down\&. |
| 232 |
* Either the grab window is an ancestor of (or is) the focus |
| 233 |
window, OR the grab window is a descendent of the focus |
| 234 |
window and contains the device\&. |
| 235 |
* A passive grab on the same button/modifier combination does |
| 236 |
not exist on any ancestor of grab_window\&. |
| 237 |
.fi |
| 238 |
.if n \{\ |
| 239 |
.RE |
| 240 |
.\} |
| 241 |
.sp |
| 242 |
.if n \{\ |
| 243 |
.RS 4 |
| 244 |
.\} |
| 245 |
.nf |
| 246 |
The interpretation of the remaining arguments is as for |
| 247 |
XIGrabDevice\&. The active grab is terminated automatically when |
| 248 |
the logical state of the device has all buttons or keys |
| 249 |
released (independent of the logical state of the modifier |
| 250 |
keys)\&. |
| 251 |
.fi |
| 252 |
.if n \{\ |
| 253 |
.RE |
| 254 |
.\} |
| 255 |
.sp |
| 256 |
.if n \{\ |
| 257 |
.RS 4 |
| 258 |
.\} |
| 259 |
.nf |
| 260 |
If the device is an attached slave device, the device is |
| 261 |
automatically detached from the master device when the grab |
| 262 |
activates and reattached to the same master device when the |
| 263 |
grab deactivates\&. If the master device is removed while the |
| 264 |
device is floating as a result of a grab, the device remains |
| 265 |
floating once the grab deactivates\&. |
| 266 |
.fi |
| 267 |
.if n \{\ |
| 268 |
.RE |
| 269 |
.\} |
| 270 |
.sp |
| 271 |
.if n \{\ |
| 272 |
.RS 4 |
| 273 |
.\} |
| 274 |
.nf |
| 275 |
Note that the logical state of a device (as seen by client |
| 276 |
applications) may lag the physical state if device event |
| 277 |
processing is frozen\&. |
| 278 |
.fi |
| 279 |
.if n \{\ |
| 280 |
.RE |
| 281 |
.\} |
| 282 |
.sp |
| 283 |
.if n \{\ |
| 284 |
.RS 4 |
| 285 |
.\} |
| 286 |
.nf |
| 287 |
This request overrides all previous grabs by the same client on |
| 288 |
the same button/modifier or keycode/modifier combinations on the |
| 289 |
same window\&. A modifiers of XIAnyModifier is equivalent to |
| 290 |
issuing the grab request for all possible modifier combinations |
| 291 |
(including the combination of no modifiers)\&. It is not required |
| 292 |
that all modifiers specified have currently assigned KeyCodes\&. |
| 293 |
A button of XIAnyButton is equivalent to issuing the request |
| 294 |
for all possible buttons\&. Otherwise, it is not required that |
| 295 |
the specified button currently be assigned to a physical |
| 296 |
button\&. |
| 297 |
.fi |
| 298 |
.if n \{\ |
| 299 |
.RE |
| 300 |
.\} |
| 301 |
.sp |
| 302 |
.if n \{\ |
| 303 |
.RS 4 |
| 304 |
.\} |
| 305 |
.nf |
| 306 |
If some other client has already issued a XIGrabButton or |
| 307 |
XIGrabKeycode with the same button/modifier or keycode/modifier |
| 308 |
combination on the same window, a BadAccess error results\&. When |
| 309 |
using XIAnyModifier or XIAnyButton , the request fails |
| 310 |
completely, and a XIBadAccess error results (no grabs are |
| 311 |
established) if there is a conflicting grab for any |
| 312 |
combination\&. XIGrabButton and XIGrabKeycode have no effect on an |
| 313 |
active grab\&. |
| 314 |
.fi |
| 315 |
.if n \{\ |
| 316 |
.RE |
| 317 |
.\} |
| 318 |
.sp |
| 319 |
.if n \{\ |
| 320 |
.RS 4 |
| 321 |
.\} |
| 322 |
.nf |
| 323 |
On success, XIGrabButton, XIGrabKeycode, XIGrabTouchBegin, |
| 324 |
XIGrabPinchGestureBegin and XIGrabSwipeGestureBegin return 0; |
| 325 |
If one or more modifier combinations could not be grabbed, |
| 326 |
XIGrabButton, XIGrabKeycode, XIGrabTouchBegin, XIGrabPinchGestureBegin |
| 327 |
and XIGrabSwipeGestureBegin return the number of |
| 328 |
failed combinations and modifiers_inout contains the failed combinations |
| 329 |
and their respective error codes\&. |
| 330 |
.fi |
| 331 |
.if n \{\ |
| 332 |
.RE |
| 333 |
.\} |
| 334 |
.sp |
| 335 |
.if n \{\ |
| 336 |
.RS 4 |
| 337 |
.\} |
| 338 |
.nf |
| 339 |
XIGrabButton, XIGrabKeycode, XIGrabTouchBegin, XIGrabPinchGestureBegin |
| 340 |
and XIGrabSwipeGestureBegin can generate BadClass, |
| 341 |
BadDevice, BadMatch, BadValue, and BadWindow errors\&. |
| 342 |
.fi |
| 343 |
.if n \{\ |
| 344 |
.RE |
| 345 |
.\} |
| 346 |
.sp |
| 347 |
.if n \{\ |
| 348 |
.RS 4 |
| 349 |
.\} |
| 350 |
.nf |
| 351 |
XIUngrabButton, XIUngrabKeycode, XIUngrabTouchBegin, XIUngrabPinchGestureBegin |
| 352 |
and XIUngrabSwipeGestureBegin release the |
| 353 |
passive grab for a button/modifier, keycode/modifier or touch/modifier |
| 354 |
combination on the specified window if it was grabbed by this client\&. A |
| 355 |
modifier of XIAnyModifier is equivalent to issuing the ungrab request |
| 356 |
for all possible modifier combinations, including the |
| 357 |
combination of no modifiers\&. A button of XIAnyButton is |
| 358 |
equivalent to issuing the request for all possible buttons\&. |
| 359 |
XIUngrabButton and XIUngrabKeycode have no effect on an active |
| 360 |
grab\&. |
| 361 |
.fi |
| 362 |
.if n \{\ |
| 363 |
.RE |
| 364 |
.\} |
| 365 |
.sp |
| 366 |
.if n \{\ |
| 367 |
.RS 4 |
| 368 |
.\} |
| 369 |
.nf |
| 370 |
XIUngrabButton, XIUngrabKeycode, XIUngrabTouchBegin, |
| 371 |
XIUngrabPinchGestureBegin and XIUngrabSwipeGestureBegin can generate |
| 372 |
BadDevice, BadMatch, BadValue and BadWindow errors\&. |
| 373 |
.fi |
| 374 |
.if n \{\ |
| 375 |
.RE |
| 376 |
.\} |
| 377 |
.SH "RETURN VALUE" |
| 378 |
.sp |
| 379 |
.if n \{\ |
| 380 |
.RS 4 |
| 381 |
.\} |
| 382 |
.nf |
| 383 |
XIGrabButton, XIGrabKeycode, XIGrabTouchBegin and |
| 384 |
XIGrabPinchGestureBegin and XIGrabSwipeGestureBegin return the number of |
| 385 |
modifier combination that could not establish a passive grab\&. The |
| 386 |
modifiers are returned in modifiers_inout, along with the respective |
| 387 |
error for this modifier combination\&. If XIGrabButton, XIGrabKeycode |
| 388 |
or XIGrabTouchBegin return zero, passive grabs with all requested |
| 389 |
modifier combinations were established successfully\&. |
| 390 |
.fi |
| 391 |
.if n \{\ |
| 392 |
.RE |
| 393 |
.\} |
| 394 |
.SH "DIAGNOSTICS" |
| 395 |
.sp |
| 396 |
.if n \{\ |
| 397 |
.RS 4 |
| 398 |
.\} |
| 399 |
.nf |
| 400 |
BadDevice |
| 401 |
An invalid deviceid was specified\&. |
| 402 |
.fi |
| 403 |
.if n \{\ |
| 404 |
.RE |
| 405 |
.\} |
| 406 |
.sp |
| 407 |
.if n \{\ |
| 408 |
.RS 4 |
| 409 |
.\} |
| 410 |
.nf |
| 411 |
BadMatch |
| 412 |
This error may occur if XIGrabButton specified a device |
| 413 |
that has no buttons, or XIGrabKeycode specified a device |
| 414 |
that has no keys, |
| 415 |
or XIGrabTouchBegin specified a device that is not touch\-capable, |
| 416 |
or XIGrabPinchGestureBegin specified a device that is not gesture\-capable, |
| 417 |
or XIGrabSwipeGestureBegin specified a device that is not gesture\-capable\&. |
| 418 |
.fi |
| 419 |
.if n \{\ |
| 420 |
.RE |
| 421 |
.\} |
| 422 |
.sp |
| 423 |
.if n \{\ |
| 424 |
.RS 4 |
| 425 |
.\} |
| 426 |
.nf |
| 427 |
BadValue |
| 428 |
Some numeric value falls outside the range of values |
| 429 |
accepted by the request\&. Unless a specific range is |
| 430 |
specified for an argument, the full range defined by the |
| 431 |
argument\*(Aqs type is accepted\&. Any argument defined as a |
| 432 |
set of alternatives can generate this error\&. |
| 433 |
.fi |
| 434 |
.if n \{\ |
| 435 |
.RE |
| 436 |
.\} |
| 437 |
.sp |
| 438 |
.if n \{\ |
| 439 |
.RS 4 |
| 440 |
.\} |
| 441 |
.nf |
| 442 |
BadWindow |
| 443 |
A value for a Window argument does not name a defined |
| 444 |
Window\&. |
| 445 |
.fi |
| 446 |
.if n \{\ |
| 447 |
.RE |
| 448 |
.\} |
| 449 |
.SH "BUGS" |
| 450 |
.sp |
| 451 |
.if n \{\ |
| 452 |
.RS 4 |
| 453 |
.\} |
| 454 |
.nf |
| 455 |
The protocol headers for XI 2\&.0 did not provide |
| 456 |
XIGrabModeAsync or XIGrabModeSync\&. Use GrabModeSync and |
| 457 |
GrabModeAsync instead, respectively\&. |
| 458 |
.fi |
| 459 |
.if n \{\ |
| 460 |
.RE |
| 461 |
.\} |
| 462 |
.SH "SEE ALSO" |
| 463 |
.sp |
| 464 |
.if n \{\ |
| 465 |
.RS 4 |
| 466 |
.\} |
| 467 |
.nf |
| 468 |
XIAllowEvents(libmansuffix) |
| 469 |
.fi |
| 470 |
.if n \{\ |
| 471 |
.RE |
| 472 |
.\} |