diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 25d5e2e540..0a4aa86443 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -963,6 +963,12 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) if ( !GtkAppend(item) ) return FALSE; + if ( m_style & wxMENU_TEAROFF ) + { + // change the position as the first item is the tear-off marker + pos++; + } + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data); diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 25d5e2e540..0a4aa86443 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -963,6 +963,12 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) if ( !GtkAppend(item) ) return FALSE; + if ( m_style & wxMENU_TEAROFF ) + { + // change the position as the first item is the tear-off marker + pos++; + } + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data);