NAME
XGrabButton, XUngrabButton - grab pointer buttons
SYNTAX
int XGrabButton(Display *_d_i_s_p_l_a_y, unsigned int _b_u_t_t_o_n,
unsigned int _m_o_d_i_f_i_e_r_s, Window _g_r_a_b___w_i_n_d_o_w, Bool
_o_w_n_e_r___e_v_e_n_t_s, unsigned int _e_v_e_n_t___m_a_s_k, int
_p_o_i_n_t_e_r___m_o_d_e, _k_e_y_b_o_a_r_d___m_o_d_e, Window _c_o_n_f_i_n_e___t_o, Cursor
_c_u_r_s_o_r);
int XUngrabButton(Display *_d_i_s_p_l_a_y, unsigned int _b_u_t_t_o_n,
unsigned int _m_o_d_i_f_i_e_r_s, Window _g_r_a_b___w_i_n_d_o_w);
ARGUMENTS
-
_b_u_t_t_o_n
Specifies the pointer button that is to be grabbed or released or
-
_A_n_y_B_u_t_t_o_n.
-
_c_o_n_f_i_n_e___t_o
Specifies the window to confine the pointer in or
-
_N_o_n_e.
-
_c_u_r_s_o_r
Specifies the cursor that is to be displayed or
-
_N_o_n_e.
-
_d_i_s_p_l_a_y
Specifies the connection to the X server.
-
-
_e_v_e_n_t___m_a_s_k
Specifies which pointer events are reported to the client.
-
The mask is the bitwise inclusive OR of the valid pointer event mask bits.
-
_g_r_a_b___w_i_n_d_o_w
Specifies the grab window.
-
-
_k_e_y_b_o_a_r_d___m_o_d_e
Specifies further processing of keyboard events.
-
You can pass
_G_r_a_b_M_o_d_e_S_y_n_c
or
_G_r_a_b_M_o_d_e_A_s_y_n_c.
-
_m_o_d_i_f_i_e_r_s
Specifies the set of keymasks or
-
_A_n_y_M_o_d_i_f_i_e_r.
The mask is the bitwise inclusive OR of the valid keymask bits.
-
_o_w_n_e_r___e_v_e_n_t_s
Specifies a Boolean value that indicates whether the pointer
-
events are to be reported as usual or reported with respect to the grab window
if selected by the event mask.
-
_p_o_i_n_t_e_r___m_o_d_e
Specifies further processing of pointer events.
-
You can pass
_G_r_a_b_M_o_d_e_S_y_n_c
or
_G_r_a_b_M_o_d_e_A_s_y_n_c.
DESCRIPTION
The
_X_G_r_a_b_B_u_t_t_o_n
function establishes a passive grab.
In the future,
the pointer is actively grabbed (as for
_X_G_r_a_b_P_o_i_n_t_e_r),
the last-pointer-grab time is set to the time at which the button was pressed
(as transmitted in the
_B_u_t_t_o_n_P_r_e_s_s
event), and the
_B_u_t_t_o_n_P_r_e_s_s
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 as for
_X_G_r_a_b_P_o_i_n_t_e_r.
The active grab is terminated automatically when the logical state of the
pointer has all buttons released
(independent of the state of the logical modifier keys),
at which point a
_B_u_t_t_o_n_R_e_l_e_a_s_e
event is reported to the grabbing window.
Note that the logical state of a device (as seen by client applications)
may lag the physical state if device event processing is frozen.
This request overrides all previous grabs by the same client on the same
button/key combinations on the same window.
A modifiers of
_A_n_y_M_o_d_i_f_i_e_r
is equivalent to issuing the grab request for all
possible modifier combinations (including the combination of no modifiers).
It is not required that all modifiers specified have currently assigned
KeyCodes.
A button of
_A_n_y_B_u_t_t_o_n
is equivalent to
issuing the request for all possible buttons.
Otherwise, it is not required that the specified button currently be assigned
to a physical button.
If some other client has already issued a
_X_G_r_a_b_B_u_t_t_o_n
with the same button/key combination on the same window, a
_B_a_d_A_c_c_e_s_s
error results.
When using
_A_n_y_M_o_d_i_f_i_e_r
or
_A_n_y_B_u_t_t_o_n,
the request fails completely,
and a
_B_a_d_A_c_c_e_s_s
error results (no grabs are
established) if there is a conflicting grab for any combination.
_X_G_r_a_b_B_u_t_t_o_n
has no effect on an active grab.
_X_G_r_a_b_B_u_t_t_o_n
can generate
_B_a_d_C_u_r_s_o_r,
_B_a_d_V_a_l_u_e,
and
_B_a_d_W_i_n_d_o_w
errors.
The
_X_U_n_g_r_a_b_B_u_t_t_o_n
function releases the passive button/key combination on the specified window if
it was grabbed by this client.
A modifiers of
_A_n_y_M_o_d_i_f_i_e_r
is
equivalent to issuing
the ungrab request for all possible modifier combinations, including
the combination of no modifiers.
A button of
_A_n_y_B_u_t_t_o_n
is equivalent to issuing the
request for all possible buttons.
_X_U_n_g_r_a_b_B_u_t_t_o_n
has no effect on an active grab.
_X_U_n_g_r_a_b_B_u_t_t_o_n
can generate
_B_a_d_V_a_l_u_e
and
_B_a_d_W_i_n_d_o_w
errors.
DIAGNOSTICS
-
_B_a_d_C_u_r_s_o_r
-
A value for a Cursor argument does not name a defined Cursor.
-
_B_a_d_V_a_l_u_e
-
Some numeric value falls outside the range of values accepted by the request.
Unless a specific range is specified for an argument, the full range defined
by the argument's type is accepted. Any argument defined as a set of
alternatives can generate this error.
-
_B_a_d_W_i_n_d_o_w
-
A value for a Window argument does not name a defined Window.
SEE ALSO
XAllowEvents(3X11),
XGrabPointer(3X11),
XGrabKey(3X11),
XGrabKeyboard(3X11),
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e