Make "qwerty2" the default charmap.
This patch makes "qwerty2" the default charmap for skins that
don't specifiy one explicitely. Note that the "qwerty" charmap
is here for historical reasons only. All skins provided by all
SDK Android platforms explicitely mention "qwerty2", so this patch
will mainly impact "magic skins" like those created by an option
like "-skin 1024x768".
This gets rid of the obsolete "qwerty" charmap (it was never
used by any of the skins provided by the SDK, and is incorrect).
+ Simplify android/charmap.[hc] code.
+ Lazy-load the charmap name in hw/goldfish_events_device.c
diff --git a/android/charmap.h b/android/charmap.h
index 6bf35c0..4c39495 100644
--- a/android/charmap.h
+++ b/android/charmap.h
@@ -51,7 +51,10 @@
char* charmap_name,
int max_len);
-/* Initialzes key charmap array.
+/* Gets a pointer to the default hard-coded charmap */
+const AKeyCharmap* android_get_default_charmap(void);
+
+/* Parse a charmap file and add it to our list.
* 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
@@ -61,24 +64,21 @@
* 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.
-*/
+ *
+ * Note: on success, the charmap will be returned by android_get_charmap()
+ */
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.
+ * This routine tries to find a charmap by name. This will compare the
+ * name to the default charmap's name, or any charmap loaded with
+ * android_charmap_setup(). Returns NULL on failure.
*/
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')
@@ -90,10 +90,15 @@
int down,
AKeycodeBuffer* keycodes);
-/* Gets default charmap (index 0) */
-const AKeyCharmap* android_get_default_charmap(void);
+/* Return a pointer to the active charmap. If android_charmap_setup() was
+ * called succesfully, this corresponds to the newly loaded charmap.
+ *
+ * Otherwise, return a pointer to the default charmap.
+ */
+const AKeyCharmap* android_get_charmap(void);
-/* Gets name of the default charmap (index 0) */
-const char* android_get_default_charmap_name(void);
+/* Return the name of the charmap to be used. Same as
+ * android_get_charmap()->name */
+const char* android_get_charmap_name(void);
#endif /* _android_charmap_h */