aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2010-07-22 11:23:19 -0700
committerVladimir Chtchetkine <vchtchetkine@google.com>2010-07-22 11:23:19 -0700
commit43552dc4fa64aad0c9fdb8f4c92ae7ac79406596 (patch)
treeb1263d1a7fc5cf44f4f05334d73927dd91148609 /android
parent2fa5173bd1ce7341c50adac676a317945f0969c7 (diff)
downloadexternal_qemu-43552dc4fa64aad0c9fdb8f4c92ae7ac79406596.zip
external_qemu-43552dc4fa64aad0c9fdb8f4c92ae7ac79406596.tar.gz
external_qemu-43552dc4fa64aad0c9fdb8f4c92ae7ac79406596.tar.bz2
Remove UI dependency from goldfish_event_device.c
Change-Id: Iea5edfbae0caff45161c814d631d35d2e6d61d1c
Diffstat (limited to 'android')
-rw-r--r--android/charmap.c23
-rw-r--r--android/charmap.h6
-rw-r--r--android/console.c2
-rw-r--r--android/main.c5
4 files changed, 33 insertions, 3 deletions
diff --git a/android/charmap.c b/android/charmap.c
index af4163a..553ad67 100644
--- a/android/charmap.c
+++ b/android/charmap.c
@@ -265,8 +265,8 @@ static const AKeyCharmap _qwerty2_charmap =
/* Custom character map created with -charmap option. */
static AKeyCharmap android_custom_charmap = { 0 };
-const AKeyCharmap** android_charmaps = 0;
-int android_charmap_count = 0;
+static const AKeyCharmap** android_charmaps = 0;
+static int android_charmap_count = 0;
/* Checks if a character represents an end of the line.
* Returns a non-zero value if ch is an EOL character. Returns
@@ -693,6 +693,13 @@ parse_kcm_file(const char* kcm_file_path, AKeyCharmap* char_map) {
int
android_charmap_setup(const char* kcm_file_path) {
+ // android_charmap_count being non-zero is used here as a flag,
+ // indicating that charmap has been initialized for the running
+ // executable.
+ if (android_charmap_count != 0) {
+ return 0;
+ }
+
if (NULL != kcm_file_path) {
if (!parse_kcm_file(kcm_file_path, &android_custom_charmap)) {
// Here we have two default charmaps and the custom one.
@@ -820,3 +827,15 @@ android_charmap_reverse_map_unicode(const AKeyCharmap* cmap,
/* no match */
return 0;
}
+
+const AKeyCharmap*
+android_get_default_charmap(void)
+{
+ return android_get_charmap_by_index(0);
+}
+
+const char*
+android_get_default_charmap_name(void)
+{
+ return android_get_default_charmap()->name;
+}
diff --git a/android/charmap.h b/android/charmap.h
index 08b059d..6bf35c0 100644
--- a/android/charmap.h
+++ b/android/charmap.h
@@ -90,4 +90,10 @@ android_charmap_reverse_map_unicode(const AKeyCharmap* cmap,
int down,
AKeycodeBuffer* keycodes);
+/* Gets default charmap (index 0) */
+const AKeyCharmap* android_get_default_charmap(void);
+
+/* Gets name of the default charmap (index 0) */
+const char* android_get_default_charmap_name(void);
+
#endif /* _android_charmap_h */
diff --git a/android/console.c b/android/console.c
index a7b55e9..f913f7d 100644
--- a/android/console.c
+++ b/android/console.c
@@ -1807,7 +1807,7 @@ do_event_text( ControlClient client, char* args )
}
/* Get default charmap. */
- charmap = android_get_charmap_by_index(0);
+ charmap = android_get_default_charmap();
if (charmap == NULL) {
control_write( client, "KO: no character map active in current device layout/config\r\n" );
return -1;
diff --git a/android/main.c b/android/main.c
index 04d715c..88ce36b 100644
--- a/android/main.c
+++ b/android/main.c
@@ -2174,6 +2174,11 @@ int main(int argc, char **argv)
args[n++] = opts->http_proxy;
}
+ if (opts->charmap) {
+ args[n++] = "-charmap";
+ args[n++] = opts->charmap;
+ }
+
/* physical memory */
args[n++] = "-m";
args[n++] = opts->memory;