1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

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
This commit is contained in:
Doug Torrance
2017-08-12 22:12:29 -04:00
committed by Carlos R. Mafra
parent ad4545b1d8
commit b07075aed3

View File

@@ -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 {