


XChangeKeyboardControl(3X11)			 XChangeKeyboardControl(3X11)
X11R5									X11R5



NAME
  XChangeKeyboardControl, XGetKeyboardControl, XAutoRepeatOn, XAutoRepeatOff,
  XBell, XQueryKeymap, XKeyboardControl	- manipulate keyboard settings and
  keyboard control structure

SYNTAX
  XChangeKeyboardControl(_d_i_s_p_l_a_y, _v_a_l_u_e__m_a_s_k, _v_a_l_u_e_s)
	Display	*_d_i_s_p_l_a_y;
	unsigned long _v_a_l_u_e__m_a_s_k;
	XKeyboardControl *_v_a_l_u_e_s;

  XGetKeyboardControl(_d_i_s_p_l_a_y, _v_a_l_u_e_s__r_e_t_u_r_n)
	Display	*_d_i_s_p_l_a_y;
	XKeyboardState *_v_a_l_u_e_s__r_e_t_u_r_n;

  XAutoRepeatOn(_d_i_s_p_l_a_y)
	Display	*_d_i_s_p_l_a_y;

  XAutoRepeatOff(_d_i_s_p_l_a_y)
	Display	*_d_i_s_p_l_a_y;

  XBell(_d_i_s_p_l_a_y, _p_e_r_c_e_n_t)
	Display	*_d_i_s_p_l_a_y;
	int _p_e_r_c_e_n_t;

  XQueryKeymap(_d_i_s_p_l_a_y,	_k_e_y_s__r_e_t_u_r_n)
	Display	*_d_i_s_p_l_a_y;
	char _k_e_y_s__r_e_t_u_r_n[32];

ARGUMENTS

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

  _k_e_y_s__r_e_t_u_r_n
	    Returns an array of	bytes that identifies which keys are pressed
	    down.  Each	bit represents one key of the keyboard.

  _p_e_r_c_e_n_t   Specifies the volume for the bell, which can range from -100 to
	    100	inclusive.

  _v_a_l_u_e__m_a_s_k
	    Specifies which controls to	change.	 This mask is the bitwise
	    inclusive OR of the	valid control mask bits.

  _v_a_l_u_e_s    Specifies one value	for each bit set to 1 in the mask.

  _v_a_l_u_e_s__r_e_t_u_r_n
	    Returns the	current	keyboard controls in the specified _X_K_e_y_b_o_a_r_d_-
	    _S_t_a_t_e structure.



DESCRIPTION
  The _X_C_h_a_n_g_e_K_e_y_b_o_a_r_d_C_o_n_t_r_o_l function controls the keyboard characteristics
  defined by the _X_K_e_y_b_o_a_r_d_C_o_n_t_r_o_l structure.  The value_mask argument speci-
  fies which values are	to be changed.


  _X_C_h_a_n_g_e_K_e_y_b_o_a_r_d_C_o_n_t_r_o_l can generate _B_a_d_M_a_t_c_h and _B_a_d_V_a_l_u_e errors.

  The _X_G_e_t_K_e_y_b_o_a_r_d_C_o_n_t_r_o_l function returns the current control values for the
  keyboard to the _X_K_e_y_b_o_a_r_d_S_t_a_t_e structure.

  The _X_A_u_t_o_R_e_p_e_a_t_O_n function turns on auto-repeat for the keyboard on the
  specified display.

  The _X_A_u_t_o_R_e_p_e_a_t_O_f_f function turns off	auto-repeat for	the keyboard on	the
  specified display.

  The _X_B_e_l_l function rings the bell on the keyboard on the specified display,
  if possible.	The specified volume is	relative to the	base volume for	the
  keyboard.  If	the value for the percent argument is not in the range -100
  to 100 inclusive, a _B_a_d_V_a_l_u_e error results.  The volume at which the bell
  rings	when the percent argument is nonnegative is:

       base - [(base * percent)	/ 100] + percent

  The volume at	which the bell rings when the percent argument is negative
  is:

       base + [(base * percent)	/ 100]

  To change the	base volume of the bell, use _X_C_h_a_n_g_e_K_e_y_b_o_a_r_d_C_o_n_t_r_o_l.

  _X_B_e_l_l	can generate a _B_a_d_V_a_l_u_e	error.

  The _X_Q_u_e_r_y_K_e_y_m_a_p function returns a bit vector for the logical state of the
  keyboard, where each bit set to 1 indicates that the corresponding key is
  currently pressed down.  The vector is represented as	32 bytes.  Byte	N
  (from	0) contains the	bits for keys 8N to 8N + 7 with	the least-significant
  bit in the byte representing key 8N.

  Note that the	logical	state of a device (as seen by client applications)
  may lag the physical state if	device event processing	is frozen.

STRUCTURES
  The _X_K_e_y_b_o_a_r_d_C_o_n_t_r_o_l structure contains:

  /* Mask bits for ChangeKeyboardControl */


  #define

	    _K_B_K_e_y_C_l_i_c_k_P_e_r_c_e_n_t

				(1L<<0)


  #define

	    _K_B_B_e_l_l_P_e_r_c_e_n_t

				(1L<<1)


  #define

	    _K_B_B_e_l_l_P_i_t_c_h

				(1L<<2)


  #define

	    _K_B_B_e_l_l_D_u_r_a_t_i_o_n

				(1L<<3)


  #define

	    _K_B_L_e_d

				(1L<<4)


  #define

	    _K_B_L_e_d_M_o_d_e

				(1L<<5)


  #define

	    _K_B_K_e_y

				(1L<<6)


  #define

	    _K_B_A_u_t_o_R_e_p_e_a_t_M_o_d_e

				(1L<<7)

  /* Values */

  typedef struct {
	  int key_click_percent;
	  int bell_percent;
	  int bell_pitch;
	  int bell_duration;
	  int led;
	  int led_mode;	  /* LedModeOn,	LedModeOff */
	  int key;
	  int auto_repeat_mode;	  /* AutoRepeatModeOff,	AutoRepeatModeOn,
				  AutoRepeatModeDefault	*/
  } XKeyboardControl;

  The key_click_percent	member sets the	volume for key clicks between 0	(off)
  and 100 (loud) inclusive, if possible. A setting of -1 restores the
  default.  Other negative values generate a _B_a_d_V_a_l_u_e error.

  The bell_percent sets	the base volume	for the	bell between 0 (off) and 100
  (loud) inclusive, if possible. A setting of -1 restores the default.	Other
  negative values generate a _B_a_d_V_a_l_u_e error.  The bell_pitch member sets the
  pitch	(specified in Hz) of the bell, if possible.  A setting of -1 restores
  the default.	Other negative values generate a _B_a_d_V_a_l_u_e error.  The
  bell_duration	member sets the	duration of the	bell specified in mil-
  liseconds, if	possible. A setting of -1 restores the default.	 Other nega-
  tive values generate a _B_a_d_V_a_l_u_e error.

  If both the led_mode and led members are specified, the state	of that	LED
  is changed, if possible. The led_mode	member can be set to _L_e_d_M_o_d_e_O_n or
  _L_e_d_M_o_d_e_O_f_f.  If only led_mode	is specified, the state	of all LEDs are
  changed, if possible.	At most	32 LEDs	numbered from one are supported. No
  standard interpretation of LEDs is defined.  If led is specified without
  led_mode, a _B_a_d_M_a_t_c_h error results.

  If both the auto_repeat_mode and key members are specified, the
  auto_repeat_mode of that key is changed (according to	_A_u_t_o_R_e_p_e_a_t_M_o_d_e_O_n,
  _A_u_t_o_R_e_p_e_a_t_M_o_d_e_O_f_f, or	_A_u_t_o_R_e_p_e_a_t_M_o_d_e_D_e_f_a_u_l_t),	if possible.  If only
  auto_repeat_mode is specified, the global auto_repeat_mode for the entire
  keyboard is changed, if possible, and	does not affect	the per	key settings.
  If a key is specified	without	an auto_repeat_mode, a _B_a_d_M_a_t_c_h	error
  results.  Each key has an individual mode of whether or not it should
  auto-repeat and a default setting for	the mode.  In addition,	there is a
  global mode of whether auto-repeat should be enabled or not and a default
  setting for that mode.  When global mode is _A_u_t_o_R_e_p_e_a_t_M_o_d_e_O_n,	keys should
  obey their individual	auto-repeat modes.  When global	mode is	_A_u_t_o_R_e_p_e_a_t_-
  _M_o_d_e_O_f_f, no keys should auto-repeat.	An auto-repeating key generates
  alternating _K_e_y_P_r_e_s_s and _K_e_y_R_e_l_e_a_s_e events.  When a key is used as a modif-
  ier, it is desirable for the key not to auto-repeat, regardless of its
  auto-repeat setting.

  The _X_K_e_y_b_o_a_r_d_S_t_a_t_e structure contains:

  typedef struct {
	  int key_click_percent;
	  int bell_percent;
	  unsigned int bell_pitch, bell_duration;
	  unsigned long	led_mask;
	  int global_auto_repeat;
	  char auto_repeats[32];
  } XKeyboardState;

  For the LEDs,	the least-significant bit of led_mask corresponds to LED one,
  and each bit set to 1	in led_mask indicates an LED that is lit.  The
  global_auto_repeat member can	be set to _A_u_t_o_R_e_p_e_a_t_M_o_d_e_O_n or _A_u_t_o_R_e_p_e_a_t_M_o_d_e_-
  _O_f_f.	The auto_repeats member	is a bit vector.  Each bit set to 1 indicates
  that auto-repeat is enabled for the corresponding key.  The vector is
  represented as 32 bytes. Byte	N (from	0) contains the	bits for keys 8N to
  8N + 7 with the least-significant bit	in the byte representing key 8N.

DIAGNOSTICS

  _B_a_d_M_a_t_c_h  Some argument or pair of arguments has the correct type and	range
	    but	fails to match in some other way required by the request.

  _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 gen-
	    erate this error.



SEE ALSO
  XChangeKeyboardMapping(3X11),	XSetPointerMapping(3X11)
  _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e































































