Commit 53af829f authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

Send both press and release events

parent 53065a6d
......@@ -693,6 +693,24 @@ on_repeat_timeout_init (EekboardContextService *context)
return FALSE;
}
static void
on_key_activated(EekKeyboard *keyboard,
EekKey *key,
EekboardContextService *context,
gboolean pressed)
{
guint keycode = eek_key_get_keycode (key);
EekSymbol *symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
guint modifiers = eek_keyboard_get_modifiers (context->priv->keyboard);
// Insert
EekboardContext ec = {0};
Client c = {&ec, 0, {0}};
emit_key_activated(&ec, keycode, symbol, modifiers, &c, pressed);
}
static void
on_key_pressed (EekKeyboard *keyboard,
EekKey *key,
......@@ -714,6 +732,7 @@ on_key_pressed (EekKeyboard *keyboard,
g_timeout_add (delay,
(GSourceFunc)on_repeat_timeout_init,
context);
on_key_activated(keyboard, key, context, TRUE);
}
static void
......@@ -726,20 +745,8 @@ on_key_released (EekKeyboard *keyboard,
if (context->priv->repeat_timeout_id > 0) {
g_source_remove (context->priv->repeat_timeout_id);
context->priv->repeat_timeout_id = 0;
guint keycode = eek_key_get_keycode (key);
EekSymbol *symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
guint modifiers = eek_keyboard_get_modifiers (context->priv->keyboard);
/* KeyActivated signal has not been emitted in repeat handler */
// Insert
EekboardContext ec = {0};
Client c = {&ec, 0, {0}};
emit_key_activated(&ec, keycode, symbol, modifiers, &c);
}
on_key_activated(keyboard, key, context, FALSE);
}
static void
......
......@@ -151,7 +151,8 @@ send_fake_modifier_key_event (Client *client,
static void
send_fake_key_event (Client *client,
guint xkeysym,
guint keyboard_modifiers)
guint keyboard_modifiers,
gboolean pressed)
{
GdkDisplay *display = gdk_display_get_default ();
Display *xdisplay = NULL; // GDK_DISPLAY_XDISPLAY (display);
......@@ -188,10 +189,7 @@ send_fake_key_event (Client *client,
modifiers |= keyboard_modifiers;
send_fake_modifier_key_event (client, modifiers, TRUE);
WaylandFakeKeyEvent (xdisplay, keycode, TRUE, 20);
//XSync (xdisplay, False);
WaylandFakeKeyEvent (xdisplay, keycode, FALSE, 20);
// XSync (xdisplay, False);
WaylandFakeKeyEvent (xdisplay, keycode, pressed, 0);
send_fake_modifier_key_event (client, modifiers, FALSE);
if (old_keysym != xkeysym)
......@@ -201,7 +199,8 @@ send_fake_key_event (Client *client,
static void
send_fake_key_events (Client *client,
EekSymbol *symbol,
guint keyboard_modifiers)
guint keyboard_modifiers,
gboolean pressed)
{
/* Ignore modifier keys */
if (eek_symbol_is_modifier (symbol))
......@@ -237,16 +236,17 @@ send_fake_key_events (Client *client,
if (EEK_IS_KEYSYM(symbol)) {
guint xkeysym = eek_keysym_get_xkeysym (EEK_KEYSYM(symbol));
send_fake_key_event (client, xkeysym, keyboard_modifiers);
send_fake_key_event (client, xkeysym, keyboard_modifiers, pressed);
}
}
void
emit_key_activated (EekboardContext *context,
guint keycode,
EekSymbol *symbol,
guint modifiers,
Client *client)
guint keycode,
EekSymbol *symbol,
guint modifiers,
Client *client,
gboolean pressed)
{
/* FIXME: figure out how to deal with Client after key presses go through
if (g_strcmp0 (eek_symbol_get_name (symbol), "cycle-keyboard") == 0) {
......@@ -275,7 +275,7 @@ emit_key_activated (EekboardContext *context,
return;
}
*/
send_fake_key_events (client, symbol, modifiers);
send_fake_key_events (client, symbol, modifiers, pressed);
}
/* Finds the first key code for each modifier and saves it in modifier_keycodes */
......
......@@ -21,7 +21,7 @@ emit_key_activated (EekboardContext *context,
guint keycode,
EekSymbol *symbol,
guint modifiers,
Client *client);
Client *client, gboolean pressed);
gboolean
client_enable_xtest (Client *client);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment