From b07075aed33e11266b86d8704082ab608734f47c Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 12 Aug 2017 22:12:29 -0400 Subject: [PATCH] wmaker: Allow WMRootMenu to reference menu files in proplist format. 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 {