X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01603d4396d632163e19f8cde798bb1807f2b8a7..d181e877b04950068cb809b0d3d1a911bea3de74:/src/gtk/menu.cpp diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index e1be8ff88a..299de20d54 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -695,6 +695,16 @@ static void menu_hide(GtkWidget*, wxMenu* menu) } } +// "can_activate_accel" from menu item +extern "C" { +static gboolean can_activate_accel(GtkWidget*, guint, wxMenu* menu) +{ + menu->UpdateUI(); + // always allow our "activate" handler to be called + return true; +} +} + IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) void wxMenu::Init() @@ -706,7 +716,7 @@ void wxMenu::Init() // NB: keep reference to the menu so that it is not destroyed behind // our back by GTK+ e.g. when it is removed from menubar: g_object_ref(m_menu); - g_object_ref_sink(m_menu); + gtk_object_sink(GTK_OBJECT(m_menu)); m_owner = (GtkWidget*) NULL; @@ -832,6 +842,8 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) } else { + g_signal_connect(menuItem, "can_activate_accel", + G_CALLBACK(can_activate_accel), this); g_signal_connect (menuItem, "activate", G_CALLBACK(menuitem_activate), mitem);