If the pointer_mode is _G_r_a_b_M_o_d_e_A_s_y_n_c, pointer event processing continues as usual. If the pointer is currently frozen by this client, the processing of events for the pointer is resumed. If the pointer_mode is _G_r_a_b_M_o_d_e_S_y_n_c, the state of the pointer, as seen by client applications, appears to freeze, and the X server generates no further pointer events until the grabbing client calls _X_A_l_l_o_w_E_v_e_n_t_s or until the pointer grab is released. Actual pointer changes are not lost while the pointer is frozen; they are simply queued in the server for later processing.
If the keyboard_mode is _G_r_a_b_M_o_d_e_A_s_y_n_c, keyboard event processing is unaffected by activation of the grab. If the keyboard_mode is _G_r_a_b_M_o_d_e_S_y_n_c, the state of the keyboard, as seen by client applications, appears to freeze, and the X server generates no further keyboard events until the grabbing client calls _X_A_l_l_o_w_E_v_e_n_t_s or until the pointer grab is released. Actual keyboard changes are not lost while the pointer is frozen; they are simply queued in the server for later processing.
If a cursor is specified, it is displayed regardless of what window the pointer is in. If _N_o_n_e is specified, the normal cursor for that window is displayed when the pointer is in grab_window or one of its subwindows; otherwise, the cursor for grab_window is displayed.
If a confine_to window is specified, the pointer is restricted to stay contained in that window. The confine_to window need have no relationship to the grab_window. If the pointer is not initially in the confine_to window, it is warped automatically to the closest edge just before the grab activates and enter/leave events are generated as usual. If the confine_to window is subsequently reconfigured, the pointer is warped automatically, as necessary, to keep it contained in the window.
The time argument allows you to avoid certain circumstances that come up if applications take a long time to respond or if there are long network delays. Consider a situation where you have two applications, both of which normally grab the pointer when clicked on. If both applications specify the timestamp from the event, the second application may wake up faster and successfully grab the pointer before the first application. The first application then will get an indication that the other application grabbed the pointer before its request was processed.
_X_G_r_a_b_P_o_i_n_t_e_r generates _E_n_t_e_r_N_o_t_i_f_y and _L_e_a_v_e_N_o_t_i_f_y events.
Either if grab_window or confine_to window is not viewable or if the confine_to window lies completely outside the boundaries of the root window, _X_G_r_a_b_P_o_i_n_t_e_r fails and returns _G_r_a_b_N_o_t_V_i_e_w_a_b_l_e. If the pointer is actively grabbed by some other client, it fails and returns _A_l_r_e_a_d_y_G_r_a_b_b_e_d. If the pointer is frozen by an active grab of another client, it fails and returns _G_r_a_b_F_r_o_z_e_n. If the specified time is earlier than the last-pointer-grab time or later than the current X server time, it fails and returns _G_r_a_b_I_n_v_a_l_i_d_T_i_m_e. Otherwise, the last-pointer-grab time is set to the specified time (_C_u_r_r_e_n_t_T_i_m_e is replaced by the current X server time).
_X_G_r_a_b_P_o_i_n_t_e_r 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_P_o_i_n_t_e_r function releases the pointer and any queued events if this client has actively grabbed the pointer from _X_G_r_a_b_P_o_i_n_t_e_r, _X_G_r_a_b_B_u_t_t_o_n, or from a normal button press. _X_U_n_g_r_a_b_P_o_i_n_t_e_r does not release the pointer if the specified time is earlier than the last-pointer-grab time or is later than the current X server time. It also generates _E_n_t_e_r_N_o_t_i_f_y and _L_e_a_v_e_N_o_t_i_f_y events. The X server performs an _U_n_g_r_a_b_P_o_i_n_t_e_r request automatically if the event window or confine_to window for an active pointer grab becomes not viewable or if window reconfiguration causes the confine_to window to lie completely outside the boundaries of the root window.
The _X_C_h_a_n_g_e_A_c_t_i_v_e_P_o_i_n_t_e_r_G_r_a_b function changes the specified dynamic parameters if the pointer is actively grabbed by the client and if the specified time is no earlier than the last-pointer-grab time and no later than the current X server time. This function has no effect on the passive parameters of a _X_G_r_a_b_B_u_t_t_o_n. The interpretation of event_mask and cursor is the same as described in _X_G_r_a_b_P_o_i_n_t_e_r.
_X_C_h_a_n_g_e_A_c_t_i_v_e_P_o_i_n_t_e_r_G_r_a_b can generate a _B_a_d_C_u_r_s_o_r and _B_a_d_V_a_l_u_e error.