Previously, WMRootMenu could either be a menu file in proplist format
itself, or it could reference another menu file in the old style format.

If WMRootMenu referenced another menu file in proplist format, this file
was parsed assuming it was in the old style format and thus failed, as
observed by Andreas Metzler [1].

In this patch, we first attempt to parse a referenced menu file as if
it were in proplist format.  If this fails, then we fall back on the old
style format.  This has the disadvantage of spamming the terminal with
various parsing errors if the menu file is in the old style format.

[1] https://www.mail-archive.com/wmaker-dev@lists.windowmaker.org/msg07097.html
---
 src/rootmenu.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/rootmenu.c b/src/rootmenu.c
index 499815fd..77b05a2a 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -1505,6 +1505,7 @@ static WMenu *configureMenu(WScreen *scr, WMPropList 
*definition)
                if (!scr->root_menu || stat_buf.st_mtime > 
scr->root_menu->timestamp
                    /* if the pointer in WMRootMenu has changed */
                    || w_global.domain.root_menu->timestamp > 
scr->root_menu->timestamp) {
+                       WMPropList *menu_from_file = NULL;
 
                        if (menu_is_default) {
                                wwarning(_
@@ -1512,7 +1513,14 @@ static WMenu *configureMenu(WScreen *scr, WMPropList 
*definition)
                                         path);
                        }
 
-                       menu = readMenuFile(scr, path);
+                       menu_from_file = WMReadPropListFromFile(path);
+                       if (menu_from_file == NULL) { /* old style menu */
+                               menu = readMenuFile(scr, path);
+                       } else {
+                               menu = configureMenu(scr, menu_from_file);
+                               WMReleasePropList(menu_from_file);
+                       }
+
                        if (menu)
                                menu->timestamp = WMAX(stat_buf.st_mtime, 
w_global.domain.root_menu->timestamp);
                } else {
-- 
2.11.0


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to