aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-03-05 19:51:28 +0100
committerMattias Andrée <m@maandree.se>2025-03-05 19:51:28 +0100
commit2ba3c7b5c33fbbbb22c619c196b63fd689885ece (patch)
tree6785f994683cf493038728a68be1fd5ae9f18398 /src/common.h
parentcleanup + cast + use pipe2 on linux (diff)
downloadredshift-ng-2ba3c7b5c33fbbbb22c619c196b63fd689885ece.tar.gz
redshift-ng-2ba3c7b5c33fbbbb22c619c196b63fd689885ece.tar.bz2
redshift-ng-2ba3c7b5c33fbbbb22c619c196b63fd689885ece.tar.xz
Merge config-ini.h and options.h into common.h
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 0e0fd3b..746238d 100644
--- a/src/common.h
+++ b/src/common.h
@@ -111,6 +111,49 @@ struct transition_scheme {
struct color_setting night;
};
+struct config_ini_setting {
+ struct config_ini_setting *next;
+ char *name;
+ char *value;
+};
+
+struct config_ini_section {
+ struct config_ini_section *next;
+ char *name;
+ struct config_ini_setting *settings;
+};
+
+struct config_ini_state {
+ struct config_ini_section *sections;
+};
+
+
+struct options {
+ /* Path to config file */
+ char *config_filepath;
+
+ struct transition_scheme scheme;
+ enum program_mode mode;
+ int verbose;
+
+ /* Temperature to set in manual mode. */
+ int temp_set;
+ /* Whether to fade between large skips in color temperature. */
+ int use_fade;
+ /* Whether to preserve gamma ramps if supported by gamma method. */
+ int preserve_gamma;
+
+ /* Selected gamma method. */
+ const struct gamma_method *method;
+ /* Arguments for gamma method. */
+ char *method_args;
+
+ /* Selected location provider. */
+ const struct location_provider *provider;
+ /* Arguments for location provider. */
+ char *provider_args;
+};
+
/* Gamma adjustment method */
typedef struct gamma_state GAMMA_STATE;
@@ -180,6 +223,23 @@ LIST_RAMPS_STOP_VALUE_TYPES(X, ;);
#undef X
+int config_ini_init(struct config_ini_state *state, const char *filepath);
+void config_ini_free(struct config_ini_state *state);
+struct config_ini_section *config_ini_get_section(struct config_ini_state *state, const char *name);
+
+
+void options_init(struct options *options);
+void options_parse_args(
+ struct options *options, int argc, char *argv[],
+ const struct gamma_method *gamma_methods,
+ const struct location_provider *location_providers);
+void options_parse_config_file(
+ struct options *options, struct config_ini_state *config_state,
+ const struct gamma_method *gamma_methods,
+ const struct location_provider *location_providers);
+void options_set_defaults(struct options *options);
+
+
void hooks_signal_period_change(enum period prev_period, enum period period);