From 71bb14f826775867d16e7d382cfdc48e6ca46ccb Mon Sep 17 00:00:00 2001 From: Vladimir Chtchetkine Date: Wed, 7 Jul 2010 15:57:00 -0700 Subject: Move key event generation out of the UI realm into neutral space. Abstracted keycode event array into keycode_array.[hc], Moved key to keycode translation into charmap.c Change-Id: I4de0c9853fa93d675895fc361e62ee36c1c0a652 --- android/charmap.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'android/charmap.h') diff --git a/android/charmap.h b/android/charmap.h index 3d34224..08b059d 100644 --- a/android/charmap.h +++ b/android/charmap.h @@ -13,6 +13,7 @@ #define _android_charmap_h #include "android/keycode.h" +#include "android/keycode-array.h" /* this defines a structure used to describe an Android keyboard charmap */ typedef struct AKeyEntry { @@ -33,12 +34,6 @@ typedef struct AKeyCharmap { char name[ AKEYCHARMAP_NAME_SIZE ]; } AKeyCharmap; -/* Array of charmaps available in the current emulator session. */ -extern const AKeyCharmap** android_charmaps; - -/* Number of entries in android_charmaps array. */ -extern int android_charmap_count; - /* Extracts charmap name from .kcm file name. * Charmap name, extracted by this routine is a name of the kcm file, trimmed * of file name extension, and shrinked (if necessary) to fit into the name @@ -72,4 +67,27 @@ int android_charmap_setup(const char* kcm_file_path); /* Cleanups initialization performed in android_charmap_setup routine. */ void android_charmap_done(void); +/* Gets charmap descriptor by its name. + * This routine finds and returns pointer to a descriptor in the array of + * charmaps that matches given name. If no such descriptor has been found, this + * routine returns NULL. + */ +const AKeyCharmap* android_get_charmap_by_name(const char* name); + +/* Gets charmap descriptor by its index in the array of charmaps. + * If index is greater than charmap array size, this routine returns NULL. + */ +const AKeyCharmap* android_get_charmap_by_index(unsigned int index); + +/* Maps given unicode key character into a keycode and adds mapped keycode into + * keycode array. This routine uses charmap passed as cmap parameter to do the + * translation, and 'down' parameter to generate appropriate ('down' or 'up') + * keycode. + */ +int +android_charmap_reverse_map_unicode(const AKeyCharmap* cmap, + unsigned int unicode, + int down, + AKeycodeBuffer* keycodes); + #endif /* _android_charmap_h */ -- cgit v1.1