Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xlookupkeysym(3x) [hpux man page]

XLookupKeysym() 														   XLookupKeysym()

Name
  XLookupKeysym - get the keysym corresponding to a keycode in structure.

Synopsis
  KeySym XLookupKeysym(event, index)
	XKeyEvent *event;
	int index;

Arguments
  event   Specifies the KeyPress or KeyRelease event that is to be used.

  index   Specifies  which  keysym  from the list associated with the keycode in the event to return.  These correspond to the modifier keys,
	  and the symbols ShiftMapIndex, LockMapIndex, ControlMapIndex, Mod1MapIndex, Mod2MapIndex, Mod3MapIndex, Mod4MapIndex, and  Mod5Map-
	  Index can be used.

Returns
  The keysym.

Description
  Given  a keyboard event and the index into the list of keysyms for that keycode, XLookupKeysym() returns the keysym from the list that cor-
  responds to the keycode in the event.  If no keysym is defined for the keycode of the event, XLookupKeysym() returns NoSymbol.

  Each keycode may have a list of associated keysyms, which are portable symbols representing the meanings of the key.	The  index  specifies
  which  keysym  in the list is desired, indicating the combination of modifier keys that are currently pressed.  Therefore, the program must
  interpret the state member of the XKeyEvent structure to determine the index before calling this function.  The exact mapping  of  modifier
  keys into the list of keysyms for each keycode is server-dependent beyond the fact that the first keysym corresponds to the keycode without
  modifier keys, and the second corresponds to the keycode with Shift pressed.

  XLookupKeysym() simply calls XKeycodeToKeysym(), using arguments taken from the specified event structure.

Structures
     typedef struct {
	 int type;		/* of event */
	 unsigned long serial;	/* # of last request processed by server */
	 Bool send_event;	/* true if this came from a SendEvent request */
	 Display *display;	/* display the event was read from */
	 Window window; 	/* "event" window it is reported relative to */
	 Window root;		/* root window that the event occured on */
	 Window subwindow;	/* child window */
	 Time time;		/* milliseconds */
	 int x, y;		/* pointer x, y coordinates in event window */
	 int x_root, y_root;	/* coordinates relative to root */
	 unsigned int state;	/* key or button mask */
	 unsigned int keycode;	/* detail */
	 Bool same_screen;	/* same screen flag */
     } XKeyEvent;

See Also
  XChangeKeyboardMapping(),  XDeleteModifiermapEntry(),  XFreeModifiermap(),   XGetKeyboardMapping(),	XGetModifierMapping(),	 XInsertModi-
  fiermapEntry(),  XKeycodeToKeysym(),	XKeysymToKeycode(),  XKeysymToString(),  XLookupString(), XNewModifiermap(), XQueryKeymap(), XRebind-
  Keysym(), XRefreshKeyboardMapping(), XSetModifierMapping(), XStringToKeysym().

Xlib - Keyboard 														   XLookupKeysym()

Check Out this Related Man Page

XLookupString() 														   XLookupString()

Name
  XLookupString - map a key event to ASCII string, keysym, and ComposeStatus.

Synopsis
  int XLookupString(event_structure, buffer_return, bytes_buffer, keysym_return,
  status_in_out)
	XKeyEvent *event_structure;
	char *buffer_return;
	int bytes_buffer;
	KeySym *keysym_return;
	XComposeStatus *status_in_out;		/* may not be implemented */

Arguments
  event_structure
	    Specifies the key event to be used.

  buffer_return
	    Returns the resulting string (not NULL-terminated).  Returned value of the function is the length of the string.

  bytes_buffer
	    Specifies the length of the buffer.  No more than bytes_buffer of translation are returned.

  keysym_return
	    If this argument is not NULL, it specifies the keysym ID computed from the event.

  status_in_out
	    Specifies  the XComposeStatus structure that contains compose key state information and that allows the compose key processing to
	    take place.  This can be NULL if the caller is not interested in seeing compose key sequences.  Not implemented in	X  Consortium
	    Xlib through Release 5.

Returns
  Length of string in buffer_return argument.

Description
  XLookupString()  gets  an  ASCII  string and a keysym that are currently mapped to the keycode in a KeyPress or KeyRelease event, using the
  modifier bits in the key event to deal with shift, lock and control.	The XLookupString() return value is  the  length  of  the  translated
  string  and  the  string's  bytes are copied into buffer_return.  The length may be greater than 1 if the event's keycode translates into a
  keysym that was rebound with XRebindKeysym().

  Note that the string returned in buffer is not NULL-terminated.  If you need a NULL-terminated string, copy buffer into another  string  as
  follows:

     len = XLookupString((XKeyEvent *)event, buffer, 10, nil, nil);
     if (len)
	 (void) strncat (cmd_buf, buffer, len);

  The compose status.in.out is not implemented in any release of the X Consortium version of Xlib through Release 5.

  In  Release  4, XLookupString() implements the new concept of keyboard groups.  Keyboard groups support having two complete sets of keysyms
  for a keyboard.  Which set will be used can be toggled using a particular key.  This is implemented by using the first two keysyms  in  the
  list	for  a key as one set, and the next two keysyms as the second set.  For more information on keyboard groups, see Volume One, Appendix
  G, Release Notes.

  For more information on using XLookupString() in general, see Volume One, Chapter 9, The Keyboard and Pointer.

Structures
     /*
      * Compose sequence status.in.out structure, used in calling XLookupString.
      */
     typedef struct _XComposeStatus {
	 char *compose_ptr;	   /* state table pointer */
	 int chars_matched;	   /* match state */
     } XComposeStatus;

     typedef struct {
	 int type;		   /* of event */
	 unsigned long serial;	   /* # of last request processed by server */
	 Bool send_event;	   /* true if this came from a SendEvent request */
	 Display *display;	   /* Display the event was read from */
	 Window window; 	   /* "event" window it is reported relative to */
	 Window root;		   /* root window that the event occured on */
	 Window subwindow;	   /* child window */
	 Time time;		   /* milliseconds */
	 int x, y;		   /* pointer x, y coordinates in event window */
	 int x_root, y_root;	   /* coordinates relative to root */
	 unsigned int state;	   /* key or button mask */
	 unsigned int keycode;	   /* detail */
	 Bool same_screen;	   /* same screen flag */
     } XKeyEvent;

See Also
  XChangeKeyboardMapping(),  XDeleteModifiermapEntry(),  XFreeModifiermap(),   XGetKeyboardMapping(),	XGetModifierMapping(),	 XInsertModi-
  fiermapEntry(),  XKeycodeToKeysym(),	XKeysymToKeycode(),  XKeysymToString(),  XLookupKeysym(), XNewModifiermap(), XQueryKeymap(), XRebind-
  Keysym(), XRefreshKeyboardMapping(), XSetModifierMapping(), XStringToKeysym().

Xlib - Keyboard 														   XLookupString()
Man Page