Set up inhibit_screensaver config option to disable the feature

This commit is contained in:
Marc Di Luzio
2019-02-03 15:45:11 +00:00
parent 6a7aa1e307
commit ba49055519
4 changed files with 28 additions and 2 deletions

View File

@@ -72,6 +72,8 @@ struct GameModeConfig {
char ioprio[CONFIG_VALUE_MAX];
long inhibit_screensaver;
long reaper_frequency;
};
@@ -168,6 +170,8 @@ static int inih_handler(void *user, const char *section, const char *name, const
valid = get_long_value(name, value, &self->renice);
} else if (strcmp(name, "ioprio") == 0) {
valid = get_string_value(value, self->ioprio);
} else if (strcmp(name, "inhibit_screensaver") == 0) {
valid = get_long_value(name, value, &self->inhibit_screensaver);
}
} else if (strcmp(section, "custom") == 0) {
/* Custom subsection */
@@ -229,6 +233,7 @@ static void load_config_files(GameModeConfig *self)
memset(self->softrealtime, 0, sizeof(self->softrealtime));
self->renice = 4; /* default value of 4 */
self->reaper_frequency = DEFAULT_REAPER_FREQ;
self->inhibit_screensaver = 1; /* Defaults to on */
/*
* Locations to load, in order
@@ -382,6 +387,16 @@ void config_get_reaper_thread_frequency(GameModeConfig *self, long *value)
memcpy_locked_config(self, value, &self->reaper_frequency, sizeof(long));
}
/*
* Gets the screensaver inhibit setting
*/
bool config_get_inhibit_screensaver(GameModeConfig *self)
{
long val;
memcpy_locked_config(self, &val, &self->inhibit_screensaver, sizeof(long));
return val == 1;
}
/*
* Get a set of scripts to call when gamemode starts
*/