


XGrabPointer(3X11)					   XGrabPointer(3X11)
X11R5									X11R5



NAME
  XGrabPointer,	XUngrabPointer,	XChangeActivePointerGrab - grab	the pointer

SYNTAX
  int XGrabPointer(_d_i_s_p_l_a_y, _g_r_a_b__w_i_n_d_o_w, _o_w_n_e_r__e_v_e_n_t_s, _e_v_e_n_t__m_a_s_k,
  _p_o_i_n_t_e_r__m_o_d_e,
		 _k_e_y_b_o_a_r_d__m_o_d_e,	_c_o_n_f_i_n_e__t_o, _c_u_r_s_o_r, _t_i_m_e)
	Display	*_d_i_s_p_l_a_y;
	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;
	Time _t_i_m_e;

  XUngrabPointer(_d_i_s_p_l_a_y, _t_i_m_e)
	Display	*_d_i_s_p_l_a_y;
	Time _t_i_m_e;

  XChangeActivePointerGrab(_d_i_s_p_l_a_y, _e_v_e_n_t__m_a_s_k,	_c_u_r_s_o_r,	_t_i_m_e)
	Display	*_d_i_s_p_l_a_y;
	unsigned int _e_v_e_n_t__m_a_s_k;
	Cursor _c_u_r_s_o_r;
	Time _t_i_m_e;

ARGUMENTS

  _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 during	the grab 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.

  _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.

  _t_i_m_e	    Specifies the time.	 You can pass either a timestamp or
	    _C_u_r_r_e_n_t_T_i_m_e.

DESCRIPTION
  The _X_G_r_a_b_P_o_i_n_t_e_r function actively grabs control of the pointer and returns
  _G_r_a_b_S_u_c_c_e_s_s if the grab was successful.  Further pointer events are
  reported only	to the grabbing	client.	 _X_G_r_a_b_P_o_i_n_t_e_r overrides	any active
  pointer grab by this client.	If owner_events	is _F_a_l_s_e, all generated
  pointer events are reported with respect to grab_window and are reported
  only if selected by event_mask.  If owner_events is _T_r_u_e and if a generated
  pointer event	would normally be reported to this client, it is reported as
  usual. Otherwise, the	event is reported with respect to the grab_window and
  is reported only if selected by event_mask.  For either value	of
  owner_events,	unreported events are discarded.

  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 unaf-
  fected 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; oth-
  erwise, the cursor for grab_window is	displayed.

  If a confine_to window is specified, the pointer is restricted to stay con-
  tained 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 win-
  dow, _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 win-
  dow.

  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 parame-
  ters 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 parame-
  ters 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.

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 argu-
	    ment, 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), XGrabButton(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	delim off





























