Commit e7ba2a0e authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

Got rid of signals in the pressed path

parent eff0449b
......@@ -210,12 +210,9 @@ eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
(gdouble)event->x,
(gdouble)event->y);
if (key) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey pressed");
g_signal_emit_by_name (key, "pressed"); // TODO: set the pressed property on the key instead
eek_keyboard_press_key(priv->keyboard, key, event->time);
on_key_pressed(priv->keyboard, key, event->time, EEK_GTK_KEYBOARD(self));
}
// TODO: send time
return TRUE;
}
......
......@@ -47,7 +47,6 @@ enum {
};
enum {
PRESSED,
RELEASED,
LOCKED,
UNLOCKED,
......@@ -74,17 +73,6 @@ struct _EekKeyPrivate
gboolean is_locked;
};
static void
eek_key_real_pressed (EekKey *self)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
priv->is_pressed = TRUE;
#if DEBUG
g_debug ("pressed %X", eek_key_get_keycode (self));
#endif
}
static void
eek_key_real_released (EekKey *self)
{
......@@ -218,7 +206,6 @@ eek_key_class_init (EekKeyClass *klass)
gobject_class->finalize = eek_key_finalize;
/* signals */
klass->pressed = eek_key_real_pressed;
klass->released = eek_key_real_released;
klass->locked = eek_key_real_locked;
klass->unlocked = eek_key_real_unlocked;
......@@ -284,25 +271,6 @@ eek_key_class_init (EekKeyClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_OREF, pspec);
/**
* EekKey::pressed:
* @key: an #EekKey
*
* The ::pressed signal is emitted each time @key is shifted to
* the pressed state. The class handler runs before signal
* handlers to allow signal handlers to read the status of @key
* with eek_key_is_pressed().
*/
signals[PRESSED] =
g_signal_new (I_("pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(EekKeyClass, pressed),
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* EekKey::released:
* @key: an #EekKey
......@@ -673,3 +641,9 @@ eek_key_is_locked (EekKey *key)
g_return_val_if_fail (EEK_IS_KEY(key), FALSE);
return key->priv->is_locked;
}
void eek_key_set_pressed(EekKey *key, gboolean value)
{
g_return_if_fail (EEK_IS_KEY(key));
key->priv->is_pressed = value;
}
......@@ -74,7 +74,6 @@ struct _EekKeyClass
/*< public >*/
/* signals */
void (* pressed) (EekKey *key);
void (* released) (EekKey *key);
void (* locked) (EekKey *key);
void (* unlocked) (EekKey *key);
......@@ -113,6 +112,8 @@ guint eek_key_get_oref (EekKey *key);
gboolean eek_key_is_pressed (EekKey *key);
gboolean eek_key_is_locked (EekKey *key);
void eek_key_set_pressed (EekKey *key,
gboolean value);
G_END_DECLS
#endif /* EEK_KEY_H */
......@@ -47,7 +47,6 @@ enum {
};
enum {
KEY_PRESSED,
KEY_RELEASED,
KEY_LOCKED,
KEY_UNLOCKED,
......@@ -278,6 +277,8 @@ void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key, guint32 timestam
EekSymbol *symbol;
EekModifierType modifier;
eek_key_set_pressed(key, TRUE);
priv->pressed_keys = g_list_prepend (priv->pressed_keys, key);
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
......@@ -299,9 +300,6 @@ void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key, guint32 timestam
Client c = {&ec, 0, {0}};
emit_key_activated(&ec, keycode, symbol, modifiers, &c, TRUE, timestamp);
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKeyboard key-pressed");
g_signal_emit (keyboard, signals[KEY_PRESSED], 0, key, timestamp);
}
static void
......@@ -469,27 +467,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
PROP_MODIFIER_BEHAVIOR,
pspec);
/**
* EekKeyboard::key-pressed:
* @keyboard: an #EekKeyboard
* @key: an #EekKey
*
* The ::key-pressed signal is emitted each time a key in @keyboard
* is shifted to the pressed state.
*/
signals[KEY_PRESSED] =
g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
0,
NULL,
NULL,
_eek_marshal_VOID__OBJECT_UINT,
G_TYPE_NONE,
2,
EEK_TYPE_KEY,
G_TYPE_UINT);
/**
* EekKeyboard::key-released:
* @keyboard: an #EekKeyboard
......
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