Fix ecore wayland key events to fill in Ecore_Event_Key with X11-like
authorChris Michael <cp.michael@samsung.com>
Mon, 25 Nov 2013 07:35:13 +0000 (07:35 +0000)
committerChris Michael <cp.michael@samsung.com>
Mon, 25 Nov 2013 07:38:00 +0000 (07:38 +0000)
values.

Previously, the keyname and key fields of the Ecore_Event_Key
structure were being filled in with the capitalized version of the
key. This is due to xkb_keysym_get_name always returning keys with the
modifier applied. There is no actual function in xkbcommon to Not do
this :/ so we have to manually check if Shift is pressed, and if so
then we need to convert the key to lowercase.

Fixes T550

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wayland/ecore_wl_input.c

index c686691..8e7255f 100644 (file)
@@ -713,6 +713,16 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
    if (keyname[0] == '\0')
      snprintf(keyname, sizeof(keyname), "Keycode-%u", code);
 
+   /* if shift is active, we need to transform the key to lower */
+   if (xkb_state_mod_index_is_active(input->xkb.state, 
+                                     xkb_map_mod_get_index(input->xkb.keymap, 
+                                                           XKB_MOD_NAME_SHIFT),
+                                     XKB_STATE_MODS_EFFECTIVE))
+     {
+        if (keyname[0] != '\0')
+          keyname[0] = tolower(keyname[0]);
+     }
+
    memset(compose, 0, sizeof(compose));
    _ecore_wl_input_keymap_translate_keysym(sym, input->modifiers, 
                                            compose, sizeof(compose));