set color/mono default pref based on main screen capability

This commit is contained in:
cy384 2021-06-05 11:25:13 -04:00
parent 13a85e4e70
commit 79e05b3847
1 changed files with 7 additions and 1 deletions

View File

@ -169,6 +169,12 @@ int save_prefs(void)
return ok; return ok;
} }
// check if the main device is black and white
int detect_color_screen(void)
{
return TestDeviceAttribute(GetMainDevice(), gdDevType);
}
void init_prefs(void) void init_prefs(void)
{ {
// initialize everything to a safe default // initialize everything to a safe default
@ -189,7 +195,7 @@ void init_prefs(void)
prefs.privkey_path = ""; prefs.privkey_path = "";
prefs.terminal_string = SSHEVEN_DEFAULT_TERM_STRING; prefs.terminal_string = SSHEVEN_DEFAULT_TERM_STRING;
prefs.auth_type = USE_PASSWORD; prefs.auth_type = USE_PASSWORD;
prefs.display_mode = COLOR; prefs.display_mode = detect_color_screen() ? COLOR : FASTEST;
prefs.fg_color = blackColor; prefs.fg_color = blackColor;
prefs.bg_color = whiteColor; prefs.bg_color = whiteColor;
prefs.font_size = 9; prefs.font_size = 9;