13
0

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.
This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2016-08-17 01:38:19 +02:00
parent 6a985df81e
commit 08df4e1920

View File

@ -396,7 +396,8 @@ _position_menu_anchored (int& x, int& y, bool& push_in,
MenuList::const_iterator i = items.begin(); MenuList::const_iterator i = items.begin();
for ( ; i != items.end(); ++i) { for ( ; i != items.end(); ++i) {
if (selected == ((std::string) i->get_label())) { const Label* label_widget = dynamic_cast<const Label*>(i->get_child());
if (label_widget && selected == ((std::string) label_widget->get_label())) {
break; break;
} }
offset += i->size_request().height; offset += i->size_request().height;