From 08df4e1920c6107266642f5b24c1ea9d77dde23e Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Wed, 17 Aug 2016 01:38:19 +0200 Subject: [PATCH] Fix anchored popups with separators in them The code computing the position of the popup menu used to compare the given string to each MenuItem::get_label() result, but that method actually replaces the content (child) of the MenuItem if that child is not already a Gtk::Label. In particular, this breaks menu separators. Avoid the issue by checking by hand if the only child of the MenuItem is a Label, and directly compare the label text. --- libs/gtkmm2ext/utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 4ba85e2f25..d4e9c57d58 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -396,7 +396,8 @@ _position_menu_anchored (int& x, int& y, bool& push_in, MenuList::const_iterator i = items.begin(); for ( ; i != items.end(); ++i) { - if (selected == ((std::string) i->get_label())) { + const Label* label_widget = dynamic_cast(i->get_child()); + if (label_widget && selected == ((std::string) label_widget->get_label())) { break; } offset += i->size_request().height;