.TH xcb_grab_button 3  2013-11-30 "XCB" "XCB Requests"
.ad l
.SH NAME
xcb_grab_button \- Grab pointer button(s)
.SH SYNOPSIS
.hy 0
.B #include <xcb/xproto.h>
.SS Request function
.HP
xcb_void_cookie_t \fBxcb_grab_button\fP(xcb_connection_t\ *\fIconn\fP, uint8_t\ \fIowner_events\fP, xcb_window_t\ \fIgrab_window\fP, uint16_t\ \fIevent_mask\fP, uint8_t\ \fIpointer_mode\fP, uint8_t\ \fIkeyboard_mode\fP, xcb_window_t\ \fIconfine_to\fP, xcb_cursor_t\ \fIcursor\fP, uint8_t\ \fIbutton\fP, uint16_t\ \fImodifiers\fP);
.br
.hy 1
.SH REQUEST ARGUMENTS
.IP \fIconn\fP 1i
The XCB connection to X11.
.IP \fIowner_events\fP 1i
If 1, the \fIgrab_window\fP will still get the pointer events. If 0, events are not
reported to the \fIgrab_window\fP.
.IP \fIgrab_window\fP 1i
Specifies the window on which the pointer should be grabbed.
.IP \fIevent_mask\fP 1i
Specifies which pointer events are reported to the client.

TODO: which values?
.IP \fIpointer_mode\fP 1i
One of the following values:
.RS 1i
.IP \fIXCB_GRAB_MODE_SYNC\fP 1i
The state of the keyboard appears to freeze: No further keyboard events are
generated by the server until the grabbing client issues a releasing
\fIAllowEvents\fP request or until the keyboard grab is released.
.IP \fIXCB_GRAB_MODE_ASYNC\fP 1i
Keyboard event processing continues normally.
.RE
.RS 1i


.RE
.IP \fIkeyboard_mode\fP 1i
One of the following values:
.RS 1i
.IP \fIXCB_GRAB_MODE_SYNC\fP 1i
The state of the keyboard appears to freeze: No further keyboard events are
generated by the server until the grabbing client issues a releasing
\fIAllowEvents\fP request or until the keyboard grab is released.
.IP \fIXCB_GRAB_MODE_ASYNC\fP 1i
Keyboard event processing continues normally.
.RE
.RS 1i


.RE
.IP \fIconfine_to\fP 1i
Specifies the window to confine the pointer in (the user will not be able to
move the pointer out of that window).

The special value \fIXCB_NONE\fP means don't confine the pointer.
.IP \fIcursor\fP 1i
Specifies the cursor that should be displayed or \fIXCB_NONE\fP to not change the
cursor.
.IP \fIbutton\fP 1i
One of the following values:
.RS 1i
.IP \fIXCB_BUTTON_INDEX_ANY\fP 1i
Any of the following (or none):
.IP \fIXCB_BUTTON_INDEX_1\fP 1i
The left mouse button.
.IP \fIXCB_BUTTON_INDEX_2\fP 1i
The right mouse button.
.IP \fIXCB_BUTTON_INDEX_3\fP 1i
The middle mouse button.
.IP \fIXCB_BUTTON_INDEX_4\fP 1i
Scroll wheel. TODO: direction?
.IP \fIXCB_BUTTON_INDEX_5\fP 1i
Scroll wheel. TODO: direction?
.RE
.RS 1i


.RE
.IP \fImodifiers\fP 1i
The modifiers to grab.

Using the special value \fIXCB_MOD_MASK_ANY\fP means grab the pointer with all
possible modifier combinations.
.SH DESCRIPTION
This request establishes a passive grab. The pointer is actively grabbed as
described in GrabPointer, the last-pointer-grab time is set to the time at
which the button was pressed (as transmitted in the ButtonPress event), and the
ButtonPress event is reported if all of the following conditions are true:

The pointer is not grabbed and the specified button is logically pressed when
the specified modifier keys are logically down, and no other buttons or
modifier keys are logically down.

The grab-window contains the pointer.

The confine-to window (if any) is viewable.

A passive grab on the same button/key combination does not exist on any
ancestor of grab-window.

The interpretation of the remaining arguments is the same as for GrabPointer.
The active grab is terminated automatically when the logical state of the
pointer has all buttons released, independent of the logical state of modifier
keys. Note that the logical state of a device (as seen by means of the
protocol) may lag the physical state if device event processing is frozen. This
request overrides all previous passive grabs by the same client on the same
button/key combinations on the same window. A modifier of AnyModifier is
equivalent to issuing the request for all possible modifier combinations
(including the combination of no modifiers). It is not required that all
specified modifiers have currently assigned keycodes. A button of AnyButton is
equivalent to issuing the request for all possible buttons. Otherwise, it is
not required that the button specified currently be assigned to a physical
button.

An Access error is generated if some other client has already issued a
GrabButton request with the same button/key combination on the same window.
When using AnyModifier or AnyButton, the request fails completely (no grabs are
established), and an Access error is generated if there is a conflicting grab
for any combination. The request has no effect on an active grab.
.SH RETURN VALUE
Returns an \fIxcb_void_cookie_t\fP. Errors (if any) have to be handled in the event loop.

If you want to handle errors directly with \fIxcb_request_check\fP instead, use \fIxcb_grab_button_checked\fP. See \fBxcb-requests(3)\fP for details.
.SH ERRORS
.IP \fIxcb_access_error_t\fP 1i
Another client has already issued a GrabButton with the same button/key
combination on the same window.
.IP \fIxcb_cursor_error_t\fP 1i
The specified \fIcursor\fP does not exist.
.IP \fIxcb_window_error_t\fP 1i
The specified \fIwindow\fP does not exist.
.IP \fIxcb_value_error_t\fP 1i
TODO: reasons?
.SH SEE ALSO
.BR xcb-requests (3)
.SH AUTHOR
Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.
