Commit 5cc40798 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

Ignore multi-clicks and non-left-buttons

parent 53af829f
...@@ -199,14 +199,20 @@ static gboolean ...@@ -199,14 +199,20 @@ static gboolean
eek_gtk_keyboard_real_button_press_event (GtkWidget *self, eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
GdkEventButton *event) GdkEventButton *event)
{ {
if (event->type != GDK_BUTTON_PRESS
|| event->button != 1) {
return TRUE;
}
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self); EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekKey *key; EekKey *key;
key = eek_renderer_find_key_by_position (priv->renderer, key = eek_renderer_find_key_by_position (priv->renderer,
(gdouble)event->x, (gdouble)event->x,
(gdouble)event->y); (gdouble)event->y);
if (key) if (key) {
g_signal_emit_by_name (key, "pressed", priv->keyboard); g_signal_emit_by_name (key, "pressed", priv->keyboard);
}
// TODO: send time
return TRUE; return TRUE;
} }
...@@ -214,12 +220,17 @@ static gboolean ...@@ -214,12 +220,17 @@ static gboolean
eek_gtk_keyboard_real_button_release_event (GtkWidget *self, eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
GdkEventButton *event) GdkEventButton *event)
{ {
if (event->type != GDK_BUTTON_RELEASE
|| event->button != 1) {
return TRUE;
}
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self); EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
GList *list, *head; GList *list, *head;
list = eek_keyboard_get_pressed_keys (priv->keyboard); list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head)) for (head = list; head; head = g_list_next (head)) {
g_signal_emit_by_name (head->data, "released", priv->keyboard); g_signal_emit_by_name (head->data, "released", priv->keyboard);
}
g_list_free (list); g_list_free (list);
return TRUE; return TRUE;
......
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