st: Use ClutterClickAction on StEntry primary/secondary icons
This makes them work on touchscreens as well. Closes: #116
This commit is contained in:
parent
2b654ec310
commit
dd59212d3f
@ -1294,9 +1294,9 @@ st_entry_get_input_hints (StEntry *entry)
|
|||||||
return clutter_text_get_input_hints (CLUTTER_TEXT (priv->entry));
|
return clutter_text_get_input_hints (CLUTTER_TEXT (priv->entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
_st_entry_icon_press_cb (ClutterActor *actor,
|
_st_entry_icon_clicked_cb (ClutterClickAction *action,
|
||||||
ClutterButtonEvent *event,
|
ClutterActor *actor,
|
||||||
StEntry *entry)
|
StEntry *entry)
|
||||||
{
|
{
|
||||||
StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
|
StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
|
||||||
@ -1305,8 +1305,6 @@ _st_entry_icon_press_cb (ClutterActor *actor,
|
|||||||
g_signal_emit (entry, entry_signals[PRIMARY_ICON_CLICKED], 0);
|
g_signal_emit (entry, entry_signals[PRIMARY_ICON_CLICKED], 0);
|
||||||
else
|
else
|
||||||
g_signal_emit (entry, entry_signals[SECONDARY_ICON_CLICKED], 0);
|
g_signal_emit (entry, entry_signals[SECONDARY_ICON_CLICKED], 0);
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1316,21 +1314,24 @@ _st_entry_set_icon (StEntry *entry,
|
|||||||
{
|
{
|
||||||
if (*icon)
|
if (*icon)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (*icon,
|
clutter_actor_remove_action_by_name (*icon, "entry-icon-action");
|
||||||
_st_entry_icon_press_cb,
|
|
||||||
entry);
|
|
||||||
clutter_actor_remove_child (CLUTTER_ACTOR (entry), *icon);
|
clutter_actor_remove_child (CLUTTER_ACTOR (entry), *icon);
|
||||||
*icon = NULL;
|
*icon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_icon)
|
if (new_icon)
|
||||||
{
|
{
|
||||||
|
ClutterAction *action;
|
||||||
|
|
||||||
*icon = g_object_ref (new_icon);
|
*icon = g_object_ref (new_icon);
|
||||||
|
|
||||||
clutter_actor_set_reactive (*icon, TRUE);
|
clutter_actor_set_reactive (*icon, TRUE);
|
||||||
clutter_actor_add_child (CLUTTER_ACTOR (entry), *icon);
|
clutter_actor_add_child (CLUTTER_ACTOR (entry), *icon);
|
||||||
g_signal_connect (*icon, "button-release-event",
|
|
||||||
G_CALLBACK (_st_entry_icon_press_cb), entry);
|
action = clutter_click_action_new ();
|
||||||
|
clutter_actor_add_action_with_name (*icon, "entry-icon-action", action);
|
||||||
|
g_signal_connect (action, "clicked",
|
||||||
|
G_CALLBACK (_st_entry_icon_clicked_cb), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (entry));
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (entry));
|
||||||
|
Loading…
Reference in New Issue
Block a user