


XGrabKeyboard(3X11)					  XGrabKeyboard(3X11)
X11R5									X11R5



NAME
  XGrabKeyboard, XUngrabKeyboard - grab	the keyboard

SYNTAX
  int XGrabKeyboard(_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,	_p_o_i_n_t_e_r__m_o_d_e,
  _k_e_y_b_o_a_r_d__m_o_d_e, _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;
	int _p_o_i_n_t_e_r__m_o_d_e, _k_e_y_b_o_a_r_d__m_o_d_e;
	Time _t_i_m_e;

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

ARGUMENTS

  _d_i_s_p_l_a_y   Specifies the connection to	the X server.

  _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 keyboard
	    events are to be reported as usual.

  _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_K_e_y_b_o_a_r_d function actively grabs control of the keyboard and	gen-
  erates _F_o_c_u_s_I_n and _F_o_c_u_s_O_u_t events.  Further key events are reported only
  to the grabbing client.  _X_G_r_a_b_K_e_y_b_o_a_r_d overrides any active keyboard grab
  by this client.  If owner_events is _F_a_l_s_e, all generated key events are
  reported with	respect	to grab_window.	If owner_events	is _T_r_u_e	and if a gen-
  erated key event would normally be reported to this client, it is reported
  normally; otherwise, the event is reported with respect to the grab_window.
  Both _K_e_y_P_r_e_s_s	and _K_e_y_R_e_l_e_a_s_e events are always reported, independent of any
  event	selection made by the client.

  If the keyboard_mode argument	is _G_r_a_b_M_o_d_e_A_s_y_n_c, keyboard event processing
  continues as usual. If the keyboard is currently frozen by this client,
  then processing of keyboard events is	resumed.  If the keyboard_mode
  argument 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 key-
  board	events until the grabbing client issues	a releasing _X_A_l_l_o_w_E_v_e_n_t_s call
  or until the keyboard	grab is	released.  Actual keyboard changes are not
  lost while the keyboard is frozen; they are simply queued in the server for
  later	processing.

  If pointer_mode is _G_r_a_b_M_o_d_e_A_s_y_n_c, pointer event processing is	unaffected by
  activation of	the grab. If 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 issues
  a releasing _X_A_l_l_o_w_E_v_e_n_t_s call	or until the keyboard 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 is actively grabbed by some other client, _X_G_r_a_b_K_e_y_b_o_a_r_d
  fails	and returns _A_l_r_e_a_d_y_G_r_a_b_b_e_d.  If	grab_window is not viewable, it	fails
  and returns _G_r_a_b_N_o_t_V_i_e_w_a_b_l_e.	If the keyboard	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-keyboard-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-
  keyboard-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_K_e_y_b_o_a_r_d	can generate _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_K_e_y_b_o_a_r_d function releases	the keyboard and any queued events if
  this client has it actively grabbed from either _X_G_r_a_b_K_e_y_b_o_a_r_d	or _X_G_r_a_b_K_e_y.
  _X_U_n_g_r_a_b_K_e_y_b_o_a_r_d does not release the keyboard	and any	queued events if the
  specified time is earlier than the last-keyboard-grab	time or	is later than
  the current X	server time.  It also generates	_F_o_c_u_s_I_n	and _F_o_c_u_s_O_u_t events.
  The X	server automatically performs an _U_n_g_r_a_b_K_e_y_b_o_a_r_d	request	if the event
  window for an	active keyboard	grab becomes not viewable.

DIAGNOSTICS

  _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), XGrabPointer(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

























