mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 07:37:21 +02:00
Set up inhibit_screensaver config option to disable the feature
This commit is contained in:
parent
6a7aa1e307
commit
ba49055519
@ -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
|
||||
*/
|
||||
|
@ -89,6 +89,11 @@ bool config_get_client_blacklisted(GameModeConfig *self, const char *client);
|
||||
*/
|
||||
void config_get_reaper_thread_frequency(GameModeConfig *self, long *value);
|
||||
|
||||
/*
|
||||
* Get whether we want to inhibit the screensaver (defaults to true)
|
||||
*/
|
||||
bool config_get_inhibit_screensaver(GameModeConfig *self);
|
||||
|
||||
/*
|
||||
* Get a set of scripts to call when gamemode starts
|
||||
*/
|
||||
|
@ -198,6 +198,7 @@ static void game_mode_context_enter(GameModeContext *self)
|
||||
}
|
||||
|
||||
/* Inhibit the screensaver */
|
||||
if (config_get_inhibit_screensaver(self->config))
|
||||
game_mode_inhibit_screensaver(true);
|
||||
}
|
||||
|
||||
@ -213,6 +214,7 @@ static void game_mode_context_leave(GameModeContext *self)
|
||||
sd_notifyf(0, "STATUS=%sGameMode is currently deactivated.%s\n", "\x1B[1;36m", "\x1B[0m");
|
||||
|
||||
/* UnInhibit the screensaver */
|
||||
if (config_get_inhibit_screensaver(self->config))
|
||||
game_mode_inhibit_screensaver(false);
|
||||
|
||||
/* Reset the governer state back to initial */
|
||||
|
@ -21,6 +21,10 @@ renice = 4
|
||||
; currently, only the best-effort class is supported thus you cannot set it here
|
||||
ioprio = 0
|
||||
|
||||
; Sets whether gamemode will inhibit the screensaver when active
|
||||
; Defaults to 1
|
||||
inhibit_screensaver=1
|
||||
|
||||
[filter]
|
||||
; If "whitelist" entry has a value(s)
|
||||
; gamemode will reject anything not in the whitelist
|
||||
|
Loading…
x
Reference in New Issue
Block a user