From 8f629012188773ffb54b1898b362166b21d3ce39 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Wed, 5 Mar 2025 13:11:06 -0600 Subject: [PATCH] gtk: don't modify horizontal alignment on menus that have arrows --- src/apprt/gtk/menu.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apprt/gtk/menu.zig b/src/apprt/gtk/menu.zig index 4700321bc0..4118097c0f 100644 --- a/src/apprt/gtk/menu.zig +++ b/src/apprt/gtk/menu.zig @@ -47,8 +47,15 @@ pub fn Menu( const menu_model = builder.getObject(gio.MenuModel, "menu").?; const menu_widget = gtk.PopoverMenu.newFromModelFull(menu_model, .{ .nested = true }); - menu_widget.as(gtk.Widget).setHalign(.start); + + // If this menu has an arrow, don't modify the horizontal alignment + // or you get visual anomalies. See PR #6087. Otherwise set the + // horizontal alignment to `start` so that the top left corner of + // the menu aligns with the point that the menu is popped up at. + if (!arrow) menu_widget.as(gtk.Widget).setHalign(.start); + menu_widget.as(gtk.Popover).setHasArrow(@intFromBool(arrow)); + _ = gtk.Popover.signals.closed.connect( menu_widget, *Self,