Hi Nicola, This isn't pretty but it works.
There is a good read about the spin button at https://blog.gtk.org/author/ebassi/ with Tim Bader on April 25, 2017. I don't know if you have seen that. My first try was just to get the GdkWindow of the spin button but that gave me the main window. No help there. Noticed that the cursor changed with the mouse movement so I went with that. Probably even more hackish than your solution. Eric /* gcc -Wall click1.c -o click1 `pkg-config --cflags --libs gtk+-3.0` Tested with Ubuntu16.04 and GTK3.18 */ #include<gtk/gtk.h> static gboolean button_press(GtkWidget *spin, GdkEvent *event, gpointer data) { GdkCursor *cursor=gdk_window_get_cursor(event->button.window); if(cursor!=NULL) g_print("Text Entry Clicked\n"); return FALSE; } int main(int argc, char *argv[]) { gtk_init (&argc, &argv); GtkWidget *window=gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Click"); gtk_window_set_default_size(GTK_WINDOW(window), 200, 50); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); GtkWidget *spin=gtk_spin_button_new_with_range(0, 10, 1); gtk_widget_set_hexpand(spin, TRUE); gtk_widget_add_events(spin, GDK_BUTTON_PRESS_MASK); g_signal_connect(spin, "button-press-event", G_CALLBACK(button_press), NULL); GtkWidget *grid=gtk_grid_new(); gtk_container_set_border_width(GTK_CONTAINER(grid), 10); gtk_grid_attach(GTK_GRID(grid), spin, 0, 0, 1, 1); gtk_container_add(GTK_CONTAINER(window), grid); gtk_widget_show_all(window); gtk_main(); return 0; } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list