diff options
author | vchtchetkine <vchtchetkine@google.com> | 2009-09-14 15:29:20 -0700 |
---|---|---|
committer | vchtchetkine <vchtchetkine@google.com> | 2009-09-21 08:37:25 -0700 |
commit | 9085a28c14f369d231dbae099a690689179f428a (patch) | |
tree | effe3ef60eeb2982f4c29361c7828174e5bd841b /android/charmap.h | |
parent | 238b4b0ef1a01afa66ef267dae4a96401ad386db (diff) | |
download | external_qemu-9085a28c14f369d231dbae099a690689179f428a.zip external_qemu-9085a28c14f369d231dbae099a690689179f428a.tar.gz external_qemu-9085a28c14f369d231dbae099a690689179f428a.tar.bz2 |
Implementation for dynamic charmap option in emulator.
Created .kcm parser and added -charmap option to the emulator, so user
can specify keyboard layout for emulator session.
Diffstat (limited to 'android/charmap.h')
-rw-r--r-- | android/charmap.h | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/android/charmap.h b/android/charmap.h index 5ac1367..7f1e959 100644 --- a/android/charmap.h +++ b/android/charmap.h @@ -24,13 +24,55 @@ typedef struct AKeyEntry { unsigned short number; } AKeyEntry; -typedef struct { +/* Defines size of name buffer in AKeyCharmap entry. */ +#define AKEYCHARMAP_NAME_SIZE 32 + +typedef struct AKeyCharmap { const AKeyEntry* entries; int num_entries; - char name[ 32 ]; + char name[ AKEYCHARMAP_NAME_SIZE ]; } AKeyCharmap; -extern const int android_charmap_count; -extern const AKeyCharmap* android_charmaps[]; +/* 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; + +/* Custom character map created with -charmap option. */ +extern AKeyCharmap android_custom_charmap; + +/* 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 + * buffer. Here are examples on how this routine extracts charmap name: + * /a/path/to/kcmfile.kcm -> kcmfile + * /a/path/to/kcmfile.ext.kcm -> kcmfile.ext + * /a/path/to/kcmfile -> kcmfile + * /a/path/to/.kcmfile -> kcmfile + * /a/path/to/.kcmfile.kcm -> .kcmfile + * kcm_file_path - Path to key charmap file to extract charmap name from. + * charmap_name - Buffer, where to save extracted charname. + * max_len - charmap_name buffer size. +*/ +void kcm_extract_charmap_name(const char* kcm_file_path, + char* charmap_name, + int max_len); + +/* Initialzes key charmap array. + * Key charmap array always contains two maps: one for qwerty, and + * another for qwerty2 keyboard layout. However, a custom layout can + * be requested with -charmap option. In tha case kcm_file_path + * parameter contains path to a .kcm file that defines that custom + * layout, and as the result, key charmap array will contain another + * entry built from that file. If -charmap option was not specified, + * kcm_file_path is NULL and final key charmap array will contain only + * two default entries. + * Returns a zero value on success, or -1 on failure. +*/ +int android_charmap_setup(const char* kcm_file_path); + +/* Cleanups initialization performed in android_charmap_setup routine. */ +void android_charmap_done(void); #endif /* _android_charmap_h */ |