I'm working on an otherwise non-GTK application (actually SDL2), where the right click into the window causes to open a GTK pop-up menu, so as you can see, here, GTK is just used for that purpose (and for some other, like file selection dialogue box, etc, but it's not the scope of my question).
I can happily use gtk_menu_popup()
, and it works nicely. The only problem is the following warning during compilation:
warning: ‘gtk_menu_popup’ is deprecated: Use '(gtk_menu_popup_at_widget, gtk_menu_popup_at_pointer, gtk_menu_popup_at_rect)' instead
Which is fair enough, so I want to use gtk_menu_popup_at_pointer()
, since this is what I want basically. However this is my problem. That it expects a trigger_event
, which I don't have, since no GTK event triggered that, but my own code, which is SDL2 ... According to the documentation I can use NULL
as the trigger_event
, however if I do this, I get the following messages at stdout, and no popup is shown:
Gtk-WARNING **: 19:10:53.512: no trigger event for menu popup
Gtk-CRITICAL **: 19:10:53.512: gtk_menu_popup_at_rect: assertion 'GDK_IS_WINDOW (rect_window)' failed
My question: is it possible to solve my problem (using GTK popup from a non-GTK application) without using deprecated function (gtk_menu_popup
- which is actually works, just it's ugly that I use a deprecated feature ...).
The popup menu is created with gtk_menu_new()
it has no "parent" or containers, or anything, since it's the only thing I want to use from GTK at this part of my application.