summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/utils.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-17 01:38:19 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-17 01:45:47 +0200
commit08df4e1920c6107266642f5b24c1ea9d77dde23e (patch)
tree5da36f5ba86034701ca05ef23743e15af974e4f2 /libs/gtkmm2ext/utils.cc
parent6a985df81efcfbe21d077a66245e2ffc80c76a11 (diff)
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.
Diffstat (limited to 'libs/gtkmm2ext/utils.cc')
-rw-r--r--libs/gtkmm2ext/utils.cc3
1 files changed, 2 insertions, 1 deletions
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<const Label*>(i->get_child());
+ if (label_widget && selected == ((std::string) label_widget->get_label())) {
break;
}
offset += i->size_request().height;