Results 1 to 2 of 2
I have this experimental little app that is supposed to pop up a menu on SIGUSR1:
Code:
GtkWidget *create_menu(void) {
GtkWidget *menu1, *menuitem1;
menu1 = gtk_menu_new ();
menuitem1 = gtk_image_menu_item_new_with_mnemonic ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-20-2012 #1Linux Newbie
- Join Date
- Dec 2011
- Posts
- 112
gtk_menu_popup() only works the first time?
I have this experimental little app that is supposed to pop up a menu on SIGUSR1:
It works properly when first called. The silly little menu pops up under the mouse. Click an entry or hit ESCAPE and it goes away. Perfect.Code:GtkWidget *create_menu(void) { GtkWidget *menu1, *menuitem1; menu1 = gtk_menu_new (); menuitem1 = gtk_image_menu_item_new_with_mnemonic ("Menu Item _1"); gtk_menu_shell_append (GTK_MENU_SHELL (menu1), menuitem1); menuitem1 = gtk_image_menu_item_new_with_mnemonic ("Menu Item _2"); gtk_menu_shell_append (GTK_MENU_SHELL (menu1), menuitem1); gtk_widget_show_all (menu1); gtk_menu_popup (GTK_MENU (menu1), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ()); return menu1; }
I send a SIGUSR1 to the app, it catches it, prints a little confirmation that it did indeed catch it, then calls gtk_widget_show_all(menu1) and gtk_menu_popup(menu1, ...), and nothing. The menu doesn't reappear. First I thought the widgets were being destroyed, but then I'd surely get a segfault on the gtk_widget_show_all().
Any notion why this would be?
- 12-21-2012 #2Linux Newbie
- Join Date
- Dec 2011
- Posts
- 112
I figured it out. To sum up:
gtk_menus and all their automagic get confused by spurious events.
The gory details are here:
View topic - gtk_menu_popup() only works once, then fails silently?



