Flutter Engine
The Flutter Engine
Functions
keysym2ucs.h File Reference
#include <X11/X.h>

Go to the source code of this file.

Functions

long keysym2ucs (KeySym keysym)
 

Function Documentation

◆ keysym2ucs()

long keysym2ucs ( KeySym  keysym)

Definition at line 818 of file keysym2ucs.c.

819{
820 int min = 0;
821 int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
822 int mid;
823
824 /* first check for Latin-1 characters (1:1 mapping) */
825 if ((keysym >= 0x0020 && keysym <= 0x007e) ||
826 (keysym >= 0x00a0 && keysym <= 0x00ff))
827 return keysym;
828
829 /* also check for directly encoded 24-bit UCS characters */
830 if ((keysym & 0xff000000) == 0x01000000)
831 return keysym & 0x00ffffff;
832
833 /* binary search in table */
834 while (max >= min) {
835 mid = (min + max) / 2;
836 if (keysymtab[mid].keysym < keysym)
837 min = mid + 1;
838 else if (keysymtab[mid].keysym > keysym)
839 max = mid - 1;
840 else {
841 /* found it */
842 return keysymtab[mid].ucs;
843 }
844 }
845
846 /* no matching Unicode value found */
847 return -1;
848}
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
struct codepair keysymtab[]
unsigned short ucs
Definition: keysym2ucs.c:41