]> git.mdlowis.com Git - proto/labwc.git/commitdiff
menu: fix menus disappearing when opening pipemenu
authortokyo4j <hrak1529@gmail.com>
Wed, 13 Nov 2024 23:14:11 +0000 (08:14 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 14 Nov 2024 06:11:13 +0000 (06:11 +0000)
Commit 7651531 introduced a regression: `menu_update_scene()` which
re-creates a menu scene was called for all the menus when a pipemenu is
created, so the menus (parent of the pipemenu) were always moved to (0,0)
and hidden, and the pipemenu was incorrectly positioned.

This commit fixes it by calling `menu_update_scene()` only for the
pipemenu when it's created.

src/menu/menu.c

index 966601eb5a3e3136123a87f84e54b0f9c01331a9..0056b719542475d78f341b313ae70793279e6349 100644 (file)
@@ -322,6 +322,7 @@ title_create_scene(struct menuitem *menuitem, int *item_y)
        *item_y += theme->menu_header_height;
 }
 
+/* (Re)creates the scene of the menu */
 static void
 menu_update_scene(struct menu *menu)
 {
@@ -370,9 +371,16 @@ menu_update_scene(struct menu *menu)
 static void
 post_processing(struct server *server)
 {
+       /*
+        * Create menu scene after all of its contents is determined
+        * (e.g. when finished reading menu.xml or received output from
+        * pipemenu program).
+        */
        struct menu *menu;
        wl_list_for_each(menu, &server->menus, link) {
-               menu_update_scene(menu);
+               if (!menu->scene_tree) {
+                       menu_update_scene(menu);
+               }
        }
 }