Delaying an event



Hi,
I have a popup menu that invokes the usual callback functions when
activated (by a user selecting a menu item):

gboolean
button_press_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
     gtk_menu_popup(GTK_MENU(popup),NULL,NULL,NULL,NULL,event->button,event->time);
}

If the gtk_menu_popup function is now called some time after the mouse-click event
by using g_timeout_add(250,button_click_cb,data), then the popup menu still
appears correctly, but when a menu item is selected, none of the callback
functions are called. Why? :

gboolean
button_press_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
...
    g_timeout_add(250,button_click_cb,data)
...
}

gboolean button_click_cb(gpointer data)
{
//   contents of "event" has been verified
     GdkEventButton *event=((button_msg_t*)data)->event;

     gtk_menu_popup(GTK_MENU(popup),NULL,NULL,NULL,NULL,event->button,event->time);

//   i've tried by commenting out this line:
     gdk_event_free((GdkEvent*)event);
...
     return FALSE;
}





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