[gnome-shell/wip/carlosg/issue-116: 2/2] st: Use ClutterClickAction on StEntry primary/secondary icons
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/issue-116: 2/2] st: Use ClutterClickAction on StEntry primary/secondary icons
- Date: Fri, 17 Aug 2018 18:29:00 +0000 (UTC)
commit dd59212d3f1d8617a6eb5989c9974846f4abf771
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 17 20:12:31 2018 +0200
st: Use ClutterClickAction on StEntry primary/secondary icons
This makes them work on touchscreens as well.
Closes: #116
src/st/st-entry.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index c7e946d90..a9c062937 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -1294,10 +1294,10 @@ st_entry_get_input_hints (StEntry *entry)
return clutter_text_get_input_hints (CLUTTER_TEXT (priv->entry));
}
-static gboolean
-_st_entry_icon_press_cb (ClutterActor *actor,
- ClutterButtonEvent *event,
- StEntry *entry)
+static void
+_st_entry_icon_clicked_cb (ClutterClickAction *action,
+ ClutterActor *actor,
+ StEntry *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);
else
g_signal_emit (entry, entry_signals[SECONDARY_ICON_CLICKED], 0);
-
- return FALSE;
}
static void
@@ -1316,21 +1314,24 @@ _st_entry_set_icon (StEntry *entry,
{
if (*icon)
{
- g_signal_handlers_disconnect_by_func (*icon,
- _st_entry_icon_press_cb,
- entry);
+ clutter_actor_remove_action_by_name (*icon, "entry-icon-action");
clutter_actor_remove_child (CLUTTER_ACTOR (entry), *icon);
*icon = NULL;
}
if (new_icon)
{
+ ClutterAction *action;
+
*icon = g_object_ref (new_icon);
clutter_actor_set_reactive (*icon, TRUE);
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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]