summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2019-10-31 14:21:57 +0100
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2019-10-31 14:21:57 +0100
commit016db85fa1178217866551f4e2d203c2815693bb (patch)
tree56b79b6c3484a30bfadfce87be9cae58569e0178 /libs/gtkmm2ext
parent07458155a290ea719dca70b876eb0922e755f7a3 (diff)
Workaround a GTKMenu bug in ArdourDropdown & co.
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/utils.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc
index 64a8eacf05..02ba1cd691 100644
--- a/libs/gtkmm2ext/utils.cc
+++ b/libs/gtkmm2ext/utils.cc
@@ -433,6 +433,24 @@ _position_menu_anchored (int& x, int& y, bool& push_in,
menu->gobj()->upper_arrow_visible = 1; /* work around a gtk bug for the first show */
}
+ /* Workaround a bug in GTK where they don't tweak the scroll offset by the arrow height
+ * if the scroll offset is negative. See the condition at:
+ * https://gitlab.gnome.org/GNOME/gtk/blob/2.24.32/gtk/gtkmenu.c#L4395
+ * and the computation of scroll_offset at:
+ * https://gitlab.gnome.org/GNOME/gtk/blob/2.24.32/gtk/gtkmenu.c#L4360
+ * */
+ int arrow_height;
+ GtkArrowPlacement arrow_placement;
+ gtk_widget_style_get (GTK_WIDGET (menu->gobj()),
+ "scroll-arrow-vlength", &arrow_height,
+ "arrow_placement", &arrow_placement,
+ NULL);
+ int scroll_tweak = menu_req.height - monitor.get_height();
+ int scroll_offset = scroll_tweak + monitor.get_y() + monitor.get_height() - y - menu_req.height;
+ if (arrow_placement != GTK_ARROWS_END && scroll_tweak > 0 && scroll_offset < 0) {
+ y -= arrow_height;
+ }
+
push_in = true;
}