Send fake key event for each character in EekText symbol.
This commit is contained in:
33
src/client.c
33
src/client.c
@ -911,8 +911,37 @@ send_fake_key_event (Client *client,
|
|||||||
guint xkeysym;
|
guint xkeysym;
|
||||||
guint keycode, replaced_keysym = 0;
|
guint keycode, replaced_keysym = 0;
|
||||||
|
|
||||||
/* Ignore special keys and modifiers */
|
/* Ignore modifier keys */
|
||||||
if (!EEK_IS_KEYSYM(symbol) || eek_symbol_is_modifier (symbol))
|
if (eek_symbol_is_modifier (symbol))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* If symbol is a text, convert chars in it to keysym */
|
||||||
|
if (EEK_IS_TEXT(symbol)) {
|
||||||
|
gchar *utf8 = eek_text_get_text (EEK_TEXT(symbol));
|
||||||
|
glong items_written;
|
||||||
|
gunichar *ucs4 = g_utf8_to_ucs4_fast (utf8, -1, &items_written);
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i = 0; i < items_written; i++) {
|
||||||
|
EekKeysym *keysym;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("U%04X", ucs4[i]);
|
||||||
|
xkeysym = XStringToKeysym (name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
keysym = eek_keysym_new (xkeysym);
|
||||||
|
send_fake_key_event (client,
|
||||||
|
EEK_SYMBOL(keysym),
|
||||||
|
keyboard_modifiers,
|
||||||
|
is_pressed);
|
||||||
|
}
|
||||||
|
g_free (ucs4);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ignore special keys */
|
||||||
|
if (!EEK_IS_KEYSYM(symbol))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xkeysym = eek_keysym_get_xkeysym (EEK_KEYSYM(symbol));
|
xkeysym = eek_keysym_get_xkeysym (EEK_KEYSYM(symbol));
|
||||||
|
|||||||
Reference in New Issue
Block a user