Make parse_follow_mode a real parser function
This commit is contained in:
parent
4b5cc2c9bc
commit
0231fabbd3
@ -21,17 +21,20 @@
|
|||||||
|
|
||||||
struct settings settings;
|
struct settings settings;
|
||||||
|
|
||||||
static void parse_follow_mode(const char *mode)
|
static enum follow_mode parse_follow_mode(const char *mode)
|
||||||
{
|
{
|
||||||
|
if (!mode)
|
||||||
|
return FOLLOW_NONE;
|
||||||
|
|
||||||
if (strcmp(mode, "mouse") == 0)
|
if (strcmp(mode, "mouse") == 0)
|
||||||
settings.f_mode = FOLLOW_MOUSE;
|
return FOLLOW_MOUSE;
|
||||||
else if (strcmp(mode, "keyboard") == 0)
|
else if (strcmp(mode, "keyboard") == 0)
|
||||||
settings.f_mode = FOLLOW_KEYBOARD;
|
return FOLLOW_KEYBOARD;
|
||||||
else if (strcmp(mode, "none") == 0)
|
else if (strcmp(mode, "none") == 0)
|
||||||
settings.f_mode = FOLLOW_NONE;
|
return FOLLOW_NONE;
|
||||||
else {
|
else {
|
||||||
LOG_W("Unknown follow mode: '%s'", mode);
|
LOG_W("Unknown follow mode: '%s'", mode);
|
||||||
settings.f_mode = FOLLOW_NONE;
|
return FOLLOW_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,14 +255,12 @@ void load_settings(char *cmdline_config_path)
|
|||||||
{
|
{
|
||||||
char *c = option_get_string(
|
char *c = option_get_string(
|
||||||
"global",
|
"global",
|
||||||
"follow", "-follow", "",
|
"follow", "-follow", NULL,
|
||||||
"Follow mouse, keyboard or none?"
|
"Follow mouse, keyboard or none?"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (strlen(c) > 0) {
|
settings.f_mode = parse_follow_mode(c);
|
||||||
parse_follow_mode(c);
|
g_free(c);
|
||||||
g_free(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.title = option_get_string(
|
settings.title = option_get_string(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user