static gboolean motion_notify_cb (GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { MyWidgetPrivate *private_data; GdkDevice *device; GdkPoint coords; gdouble x, y; private_data = MY_WIDGET (widget)->private; if (!gdk_event_get_coords (event, &x, &y)) return FALSE; device = gdk_event_get_device ((GdkEvent *) event); coords = g_new (GdkPoint); coords->x = (gint) x; coords->y = (gint) y; g_hash_table_replace (private_data->device_coords, device, coords); return TRUE; }