Lagrange [release]

Navbar menu placement

=> 73a506239e4dc8be07313147cde4046a3bd848e1

diff --git a/src/ui/root.c b/src/ui/root.c
index a3c2e0ae..64043fd3 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -318,9 +318,12 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
     if (equal_Command(cmd, "menu.open")) {
         iWidget *button = pointer_Command(cmd);
         iWidget *menu = findChild_Widget(button, "menu");
+        const iBool isPlacedUnder = argLabel_Command(cmd, "under");
         iAssert(menu);
         if (!isVisible_Widget(menu)) {
-            openMenu_Widget(menu, topLeft_Rect(bounds_Widget(button)));
+            openMenu_Widget(menu,
+                            isPlacedUnder ? bottomLeft_Rect(bounds_Widget(button))
+                                          : topLeft_Rect(bounds_Widget(button)));
         }
         else {
             closeMenu_Widget(menu);
@@ -416,7 +419,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
         }
         iWidget *menu =
             makeMenu_Widget(button, constData_Array(&items), size_Array(&items));
-        openMenu_Widget(menu, topLeft_Rect(bounds_Widget(button)));
+        openMenu_Widget(menu, bottomLeft_Rect(bounds_Widget(button)));
         deinit_Array(&items);
         return iTrue;
     }
@@ -1484,6 +1487,7 @@ void createUserInterface_Root(iRoot *d) {
         iLabelWidget *navMenu =
             makeMenuButton_LabelWidget(menu_Icon, navMenuItems_, iElemCount(navMenuItems_));
 #   endif
+        setCommand_LabelWidget(navMenu, collectNewCStr_String("menu.open under:1"));
         setAlignVisually_LabelWidget(navMenu, iTrue);
         setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu");
 #endif
diff --git a/src/ui/util.c b/src/ui/util.c
index 41e645de..31907721 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -680,7 +680,7 @@ static iBool isCommandIgnoredByMenus_(const char *cmd) {
 static iLabelWidget *parentMenuButton_(const iWidget *menu) {
     if (isInstance_Object(menu->parent, &Class_LabelWidget)) {
         iLabelWidget *button = (iLabelWidget *) menu->parent;
-        if (!cmp_String(command_LabelWidget(button), "menu.open")) {
+        if (equal_Command(cstr_String(command_LabelWidget(button)), "menu.open")) {
             return button;
         }
     }
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/release/cdiff/73a506239e4dc8be07313147cde4046a3bd848e1
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
30.756202 milliseconds
Gemini-to-HTML Time
0.296653 milliseconds

This content has been proxied by September (ba2dc).