Workaround for too-fast tooltips



Here are two macros that developers may need when building with GTK versions above 3.10
They replace the tooltip system with a call to a custom display of the
tooltip.


#define gtk_widget_set_tooltip_text(w, t) {gchar *tip = g_strdup(t);g_object_set_data(G_OBJECT(w), "tooltip", 
(gpointer)tip);gtk_widget_add_events (w, FAKE_TOOLTIPS_MASK);g_signal_connect_after (w, "destroy", 
G_CALLBACK(free_tooltip), tip);g_signal_connect (w, FAKE_TOOLTIPS_SIGNAL, G_CALLBACK (show_tooltip), tip);}

#define gtk_widget_get_tooltip_text(w) g_object_get_data (G_OBJECT(w), "tooltip")

You have to write the functions show_tooltip()and free_tooltip() yourself, of course.

The background to this is that if your applications uses tooltips
heavily (e.g. on every item of a menu) then recent versions of GTK3
throw them up too quickly, and once they start to appear they are very
difficult to throw off; the tooltip time out is no longer controllable.


Richard Shann




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]