GestureClick on GtkEntry not working

I need to capture when a “GtkEntry” is ‘Clicked’.

I added a ‘GestureClick’ controller, but it doesn’t work.

Example code:

static void
entry_click_gesture_pressed (GtkGestureClick *gesture, int n_press,  double x, double y, GtkEntry *entry)
   /* Not Working :( */
   /* gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); ? */
entry = gtk_entry_new ();
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (gesture), "entry-click-gesture");
g_signal_connect (gesture, "pressed",  G_CALLBACK (entry_click_gesture_pressed), entry);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
gtk_widget_add_controller (GTK_WIDGET (entry), GTK_EVENT_CONTROLLER (gesture));

I would appreciate the help or other example.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.