Commit 40a92fe7 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

Ignoring section.key-pressed

parent e30bb237
......@@ -210,7 +210,9 @@ eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
(gdouble)event->x,
(gdouble)event->y);
if (key) {
g_signal_emit_by_name (key, "pressed", priv->keyboard);
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey pressed");
g_signal_emit_by_name (key, "pressed");
eek_keyboard_press_key(priv->keyboard, key);
}
// TODO: send time
return TRUE;
......@@ -229,6 +231,7 @@ eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head)) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey released");
g_signal_emit_by_name (head->data, "released", priv->keyboard);
}
g_list_free (list);
......@@ -258,12 +261,14 @@ eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
if (head->data == key)
found = TRUE;
else
g_signal_emit_by_name (head->data, "cancelled", priv->keyboard);
g_signal_emit_by_name (head->data, "cancelled");
}
g_list_free (list);
if (!found)
g_signal_emit_by_name (key, "pressed", priv->keyboard);
if (!found) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey pressed");
g_signal_emit_by_name (key, "pressed");
}
}
return TRUE;
}
......@@ -281,8 +286,10 @@ eek_gtk_keyboard_real_unmap (GtkWidget *self)
EekKeyboard::key-released signal can remove elements from its
internal copy */
list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head))
g_signal_emit_by_name (head->data, "released", priv->keyboard);
for (head = list; head; head = g_list_next (head)) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey released");
g_signal_emit_by_name (head->data, "released");
}
g_list_free (list);
}
......@@ -399,6 +406,7 @@ eek_gtk_keyboard_dispose (GObject *object)
list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head)) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey pressed");
g_signal_emit_by_name (head->data, "released", priv->keyboard);
}
g_list_free (list);
......
......@@ -43,6 +43,9 @@ typedef struct _EekKeyPrivate EekKeyPrivate;
/**
* EekKey:
*
* Contains information about the state of a key.
* TODO: rewrite as a plain struct
*
* The #EekKey structure contains only private data and should only be
* accessed using the provided API.
*/
......
......@@ -91,12 +91,18 @@ eek_modifier_key_free (EekModifierKey *modkey)
g_slice_free (EekModifierKey, modkey);
}
void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKeyboard key-pressed");
g_signal_emit (keyboard, signals[KEY_PRESSED], 0, key);
}
static void
on_key_pressed (EekSection *section,
EekKey *key,
EekKeyboard *keyboard)
{
g_signal_emit (keyboard, signals[KEY_PRESSED], 0, key);
g_log("squeek", G_LOG_LEVEL_DEBUG, "DO NOT emit EekKeyboard key-pressed");
//g_signal_emit (keyboard, signals[KEY_PRESSED], 0, key);
}
static void
......@@ -104,6 +110,7 @@ on_key_released (EekSection *section,
EekKey *key,
EekKeyboard *keyboard)
{
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKeyboard key-released");
g_signal_emit (keyboard, signals[KEY_RELEASED], 0, key);
}
......
......@@ -188,5 +188,7 @@ EekModifierKey *eek_modifier_key_copy
void eek_modifier_key_free
(EekModifierKey *modkey);
void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key);
G_END_DECLS
#endif /* EEK_KEYBOARD_H */
......@@ -118,6 +118,7 @@ static void
on_pressed (EekKey *key,
EekSection *section)
{
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekSection key-pressed");
g_signal_emit (section, signals[KEY_PRESSED], 0, key);
}
......@@ -125,6 +126,7 @@ static void
on_released (EekKey *key,
EekSection *section)
{
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekSection key-released");
g_signal_emit (section, signals[KEY_RELEASED], 0, key);
}
......@@ -365,7 +367,9 @@ eek_section_class_init (EekSectionClass *klass)
g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekSectionClass, key_pressed),
// FIXME: this handler seems to be unnecessary complexity. Either remove or justify
// G_STRUCT_OFFSET(EekSectionClass, key_pressed),
0,
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
......
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