From 2ab7c0827924760756a02ecdde3e5a4e9b648827 Mon Sep 17 00:00:00 2001 From: somiaj Date: Tue, 29 Jun 2021 13:06:47 -0600 Subject: [PATCH] Cleanup SetRCDefaults() This function creates a minimum config if an empty config is loaded and is the starting point for all configs. This fixes the minimum config to ensure that users who end up here have a minimum menu that can access xterm, FvwmConsole, load the default-config, or quit fvwm. --- fvwm/fvwm3.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/fvwm/fvwm3.c b/fvwm/fvwm3.c index 9cb4db3c6..bea7ee1a5 100644 --- a/fvwm/fvwm3.c +++ b/fvwm/fvwm3.c @@ -1338,6 +1338,8 @@ static void SetRCDefaults(void) { "SetEnv FVWM_IS_FVWM3 1", "", "" }, /* The below is historical -- before we had a default * configuration which defines these and more. + * This is still used if an empty or custom config is loaded. + * Defining a minimum default menu just in case. */ { "DefaultFont", "", "" }, { "DefaultColors black grey", "", "" }, @@ -1345,34 +1347,30 @@ static void SetRCDefaults(void) { "TitleStyle Centered -- Raised", "", "" }, { "Style * Color lightgrey/dimgrey", "", "" }, { "Style * HilightFore black, HilightBack grey", "", "" }, - { "DestroyFunc FvwmMakeMissingDesktopMenu", "", "" }, - { "AddToFunc FvwmMakeMissingDesktopMenu I PipeRead 'fvwm-menu-desktop --enable-mini-icons --fvwm-icons'", "", "" }, + { "AddToFunc LoadDefaultConfig", "", "" }, + { "+ I Read "FVWM_DATADIR"/default-config/config", "", "" }, + { "+ I StartFunction", "", "" }, { "AddToMenu MenuFvwmRoot \"", _("Builtin Menu"), "\" Title" }, - { "+ MissingSubmenuFunction FvwmMakeMissingDesktopMenu","",""}, - { "+ \"&1. XTerm\" Exec xterm", "", ""}, + { "+ \"&1. XTerm\" Exec xterm", "", "" }, + { "+ \"&2. FvwmConsole\" Module FvwmConsole", "", "" }, { - "+ \"&2. ", - _("Issue fvwm commands"), - "\" Module FvwmConsole" + "+ \"&3. ", + _("Load Default Config"), + "\" LoadDefaultConfig" }, { - "+ \"&D. ", - _("Desktop Menu"), - "\" Popup FvwmMenu" + "+ \"&4. ", + _("Restart"), + " Fvwm\" Restart" }, { - "+ \"&R. ", - _("Restart fvwm"), - "\" Restart" - }, - { - "+ \"&X. ", - _("Exit fvwm"), - "\" Quit" + "+ \"&5. ", + _("Quit"), + " Fvwm\" Quit" }, { "Mouse 1 R A Menu MenuFvwmRoot", "", "" }, /* default menu navigation */ @@ -1403,7 +1401,8 @@ static void SetRCDefaults(void) ecc.type = Restarting ? EXCT_RESTART : EXCT_INIT; ecc.w.wcontext = C_ROOT; exc = exc_create_context(&ecc, ECC_TYPE | ECC_WCONTEXT); - xasprintf(&cmd, defaults[i][0], defaults[i][1], defaults[i][2]); + xasprintf(&cmd, "%s%s%s", defaults[i][0], defaults[i][1], + defaults[i][2]); execute_function(NULL, exc, cmd, 0); free(cmd); exc_destroy_context(exc);