From e8b9805124c3ceb3ec7bd6e3e09a9003ea051c30 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 5 Oct 2017 02:01:18 -0700 Subject: [PATCH] STATUS_HILITES vs multiple interface binary My tty+X11 binary was letting me see and modify status highlights under X11 even though they don't do anything. Options parsing has to accept them since we don't know which interface will be chosen, but interactive option handling does know and shouldn't show inappropriate options. initoptions_finish() should probably we validating all the wc and wc2 options, but I only added a check for trying to enable statushilites when they're unavailable. --- src/options.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/options.c b/src/options.c index 90d58f6e7..c17e44869 100644 --- a/src/options.c +++ b/src/options.c @@ -652,7 +652,7 @@ initoptions() * lists of usernames into arrays with one name per element. */ #endif -#endif +#endif /* SYSCF */ initoptions_finish(); } @@ -809,12 +809,12 @@ initoptions_finish() config_error_done(); } } else -#endif - { - config_error_init(TRUE, (char *) 0, FALSE); - read_config_file((char *) 0, SET_IN_FILE); - config_error_done(); - } +#endif /* !MAC */ + /*else*/ { + config_error_init(TRUE, (char *) 0, FALSE); + read_config_file((char *) 0, SET_IN_FILE); + config_error_done(); + } (void) fruitadd(pl_fruit, (struct fruit *) 0); /* @@ -828,6 +828,19 @@ initoptions_finish() if (iflags.bouldersym) update_bouldersym(); reglyph_darkroom(); + +#ifdef STATUS_HILITES + /* + * A multi-interface binary might only support status highlighting + * for some of the interfaces; check whether we asked for it but are + * using one which doesn't. + */ + if (iflags.hilite_delta && !wc2_supported("statushilites")) { + raw_printf("Status highlighting not supported for %s interface.", + windowprocs.name); + iflags.hilite_delta = 0; + } +#endif return; } @@ -4158,9 +4171,13 @@ doset() /* changing options via menu by Per Liboriussen */ "Other settings:", MENU_UNSELECTED); - for (i = 0; othropt[i].name; i++) - opts_add_others(tmpwin, othropt[i].name, othropt[i].code, - NULL, othropt[i].othr_count_func()); + for (i = 0; (name = othropt[i].name) != 0; i++) { + if ((is_wc_option(name) && !wc_supported(name)) + || (is_wc2_option(name) && !wc2_supported(name))) + continue; + opts_add_others(tmpwin, name, othropt[i].code, + (char *) 0, othropt[i].othr_count_func()); + } #ifdef PREFIXES_IN_USE any = zeroany; @@ -6080,6 +6097,8 @@ struct wc_Opt wc2_options[] = { { "fullscreen", WC2_FULLSCREEN }, { "use_darkgray", WC2_DARKGRAY }, { "hitpointbar", WC2_HITPOINTBAR }, { "hilite_status", WC2_HILITE_STATUS }, + /* name shown in 'O' menu is different */ + { "status hilite rules", WC2_HILITE_STATUS }, /* statushilites doesn't have its own bit */ { "statushilites", WC2_HILITE_STATUS }, { (char *) 0, 0L } }; -- 2.40.0