ecore-drm: convert compose string into utf8

Summary:
	Key event string encoding was LATIN1 instead of UTF-8.
	This unifies the handling with the x backend.

Reviewers: raster

Reviewed By: raster

CC: cedric

Differential Revision: https://phab.enlightenment.org/D912
This commit is contained in:
Moritz Bitsch 2014-05-29 11:33:20 +09:00 committed by Carsten Haitzler (Rasterman)
parent 6732ea64a9
commit 2d3ecfa20c
1 changed files with 23 additions and 3 deletions

View File

@ -294,9 +294,11 @@ _device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int
/* unsigned int *keycode; */ /* unsigned int *keycode; */
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
xkb_keysym_t sym = XKB_KEY_NoSymbol; xkb_keysym_t sym = XKB_KEY_NoSymbol;
char key[256], keyname[256], compose[256]; char key[256], keyname[256], compose_buffer[256];
Ecore_Event_Key *e; Ecore_Event_Key *e;
Ecore_Drm_Input *input; Ecore_Drm_Input *input;
char *tmp = NULL;
char *compose = NULL;
if (!(input = dev->seat->input)) return; if (!(input = dev->seat->input)) return;
@ -330,8 +332,24 @@ _device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int
keyname[0] = tolower(keyname[0]); keyname[0] = tolower(keyname[0]);
} }
memset(compose, 0, sizeof(compose)); memset(compose_buffer, 0, sizeof(compose_buffer));
_device_keysym_translate(sym, dev->xkb.modifiers, compose, sizeof(compose)); if (_device_keysym_translate(sym, dev->xkb.modifiers, compose_buffer, sizeof(compose_buffer)))
{
compose = eina_str_convert("ISO8859-1", "UTF-8",
compose_buffer);
if (!compose)
{
ERR("Ecore_DRM cannot convert input key string '%s' to UTF-8. "
"Is Eina built with iconv support?", compose_buffer);
}
else
{
tmp = compose;
}
}
if (!compose)
compose = compose_buffer;
e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
((compose[0] != '\0') ? strlen(compose) : 0) + 3); ((compose[0] != '\0') ? strlen(compose) : 0) + 3);
@ -362,6 +380,8 @@ _device_notify_key(Ecore_Drm_Evdev *dev, struct input_event *event, unsigned int
else else
ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL); ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
if (tmp)
free(tmp);
} }
static void static void