if it's in response to a button-press-event, try doing this:
Code:
gboolean button_press_cb(GtkWidget *wi, GdkEventButton *ev, gpointer data)
{
/* ...initialize menu... */
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, ev->button, ev->time);
return TRUE; /* this will stop the event, have it return FALSE to allow the click to go further */
}
the key difference here is that ev->time is used.
quoting from
http://library.gnome.org/devel/gtk/stab ... menu-popup
Quote:
The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the time stamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, gtk_get_current_event_time() can be used instead.