From f490aee025b3bab5bcdb065e5fc1b1abecf16b97 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Thu, 19 May 2011 20:51:01 +0200 Subject: Merge c80340 from master to r13: Move charmap to hardware properties The name of the emulated charmap must be passed to the guest kernel because it is used by the guest input handling code to load the proper charmap files from the system partition. This mandates that the name becomes a hardware property for the sake of supporting proper snapshotting and ui/core separation. From now on, the charmap name found in a skin will be ignored completely. This shouldn't be a problem in practice because all skins used the default name (qwerty2) anyway. The only reason to change the default value would be if emulating a guest system image that depends on a different charmap during emulation. Change-Id: If571684000b159ae9e9849661c9ff18e19b4cc75 --- android/skin/keyboard.c | 30 +++++++----------------------- android/skin/keyboard.h | 5 ++--- 2 files changed, 9 insertions(+), 26 deletions(-) (limited to 'android/skin') diff --git a/android/skin/keyboard.c b/android/skin/keyboard.c index 3ee3366..3371799 100644 --- a/android/skin/keyboard.c +++ b/android/skin/keyboard.c @@ -72,15 +72,6 @@ skin_keyboard_set_keyset( SkinKeyboard* keyboard, SkinKeyset* kset ) } -const char* -skin_keyboard_charmap_name( SkinKeyboard* keyboard ) -{ - if (keyboard && keyboard->charmap) - return keyboard->charmap->name; - - return DEFAULT_ANDROID_CHARMAP; -} - void skin_keyboard_set_rotation( SkinKeyboard* keyboard, SkinRotation rotation ) @@ -539,22 +530,15 @@ skin_keyboard_create_from_charmap_name(const char* charmap_name, } SkinKeyboard* -skin_keyboard_create_from_aconfig( AConfig* aconfig, int use_raw_keys ) +skin_keyboard_create( const char* kcm_file_path, int use_raw_keys ) { - const char* charmap_name = DEFAULT_ANDROID_CHARMAP; - AConfig* node = aconfig_find( aconfig, "keyboard" ); - if (node != NULL) { - charmap_name = aconfig_str(node, "charmap", charmap_name); - } - return skin_keyboard_create_from_charmap_name(charmap_name, use_raw_keys); -} + const char* charmap_name = DEFAULT_ANDROID_CHARMAP; + char cmap_buff[AKEYCHARMAP_NAME_SIZE]; -SkinKeyboard* -skin_keyboard_create_from_kcm( const char* kcm_file_path, int use_raw_keys ) -{ - char charmap_name[AKEYCHARMAP_NAME_SIZE]; - kcm_extract_charmap_name(kcm_file_path, charmap_name, - sizeof(charmap_name)); + if (kcm_file_path != NULL) { + kcm_extract_charmap_name(kcm_file_path, cmap_buff, sizeof cmap_buff); + charmap_name = cmap_buff; + } return skin_keyboard_create_from_charmap_name(charmap_name, use_raw_keys); } diff --git a/android/skin/keyboard.h b/android/skin/keyboard.h index a86b132..1c3b088 100644 --- a/android/skin/keyboard.h +++ b/android/skin/keyboard.h @@ -24,9 +24,8 @@ typedef void (*SkinKeyCommandFunc)( void* opaque, SkinKeyCommand command, int typedef void (*SkinKeyEventFunc)( void* opaque, AndroidKeyCode code, int down ); -extern SkinKeyboard* skin_keyboard_create_from_aconfig( AConfig* aconfig, int use_raw_keys ); - -extern SkinKeyboard* skin_keyboard_create_from_kcm( const char* kcm_file_path, int use_raw_keys ); +/* If kcm_file_path is NULL, create a keyboard using the default built-in qwerty2 charmap */ +extern SkinKeyboard* skin_keyboard_create( const char* kcm_file_path, int use_raw_keys ); extern void skin_keyboard_set_keyset( SkinKeyboard* keyboard, SkinKeyset* kset ); -- cgit v1.1