#include <gtk/gtk.h>

GtkTooltips *tips;
GtkWidget *shell;
int timer = 0;

gboolean timeout (gpointer user_data) {
	const gchar *tip_text[100];
	GdkEventMotion *event = (GdkEventMotion *)user_data;
	sprintf (tip_text, "Mouse at: %f, %f ", event->x, event->y);
	gtk_tooltips_set_tip (tips, shell, tip_text, "TIP2");
	timer = 0;	
	return FALSE;
}

gboolean motionPress (GtkWidget *widget,  GdkEventMotion *event, gpointer user_data) {
	if (!timer) {
		timer = 1;
		gtk_timeout_add (400, timeout, event);
	}
}

int main (int argc, char** argv) {
	gtk_init_check (&argc, &argv);
	
	shell = gtk_window_new (GTK_WINDOW_TOPLEVEL);	   
	tips = gtk_tooltips_new ();

	gtk_widget_add_events (shell, GDK_POINTER_MOTION_MASK);
	g_signal_connect (G_OBJECT (shell), "motion-notify-event", G_CALLBACK (motionPress), NULL);
	g_signal_connect (G_OBJECT (shell), "destroy", G_CALLBACK (gtk_main_quit), NULL);
	g_signal_connect (G_OBJECT (shell), "delete_event",G_CALLBACK (gtk_main_quit), NULL);
	gtk_widget_show (shell);
	gtk_main();
}
