im trying to show a gtk menu popup when a Clutter Actor is right-clicked. For some reason, the menu is not showing. Here is my code (not all, only the handler)
button_press_event.connect((event) => {
if (event.click_count < 2 && event.button == 1) {
debug("Icon simple click\n");
} else if (event.click_count < 2 && event.button == 3) {
debug("Showing Pop Up menu\n");
var popup_menu = new PopupMenu();
popup_menu.add_menu_item("Prueba 1");
popup_menu.show_all();
popup_menu.show_popup();
return true;
}
return false;
});
PopupMenu is a litle wrapper of gtk.menu I did
public class PopupMenu : Gtk.Menu {
public PopupMenu.from_gtk_widget (Gtk.Widget parent) {
parent.button_release_event.connect((event) => {
if(event.button == 3) this.show_popup();
return true;
});
}
construct {
}
public Gtk.MenuItem add_menu_item (string label) {
var item = new Gtk.MenuItem.with_label(label);
this.append (item);
return item;
}
//Draw the popup at the mouse position
public void show_popup() {
debug("Popup Showing\n");
this.popup(null, null, null, 2, 0);
}
}
The actor is inside an actor with flowlayout. This actor is inside a gtk window which is transparent. Debug messages are shown.
Why is this not working? thanks