From 96a6575e23b5baebcdd38269b80f47cc02a2627e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 21 Mar 2025 16:50:15 +0100 Subject: Refactor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/gamma-quartz.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/gamma-quartz.c') diff --git a/src/gamma-quartz.c b/src/gamma-quartz.c index d323d33..c05e72d 100644 --- a/src/gamma-quartz.c +++ b/src/gamma-quartz.c @@ -1,4 +1,5 @@ -/* redshift-ng - Automatically adjust display colour temperature according the Sun +/*- + * redshift-ng - Automatically adjust display colour temperature according the Sun * * Copyright (c) 2009-2018 Jon Lund Steffensen * Copyright (c) 2014-2016, 2025 Mattias Andrée @@ -27,6 +28,7 @@ struct quartz_display_state { float *saved_ramps; }; + struct gamma_state { struct quartz_display_state *displays; uint32_t display_count; @@ -41,6 +43,7 @@ quartz_create(struct gamma_state **state_out) return 0; } + static int quartz_start(struct gamma_state *state) { @@ -106,12 +109,14 @@ quartz_start(struct gamma_state *state) return 0; } + static void quartz_restore(struct gamma_state *state) { CGDisplayRestoreColorSyncSettings(); } + static void quartz_free(struct gamma_state *state) { @@ -123,6 +128,7 @@ quartz_free(struct gamma_state *state) free(state); } + static void quartz_print_help(FILE *f) { @@ -130,6 +136,7 @@ quartz_print_help(FILE *f) fputs("\n", f); } + static int quartz_set_option(struct gamma_state *state, const char *key, const char *value) { @@ -143,6 +150,7 @@ quartz_set_option(struct gamma_state *state, const char *key, const char *value) return 0; } + static void quartz_apply_for_display(struct gamma_state *state, int display_index, const colour_setting_t *setting, int preserve) { @@ -183,16 +191,15 @@ quartz_apply_for_display(struct gamma_state *state, int display_index, const col free(gamma_ramps); } + static int quartz_apply(struct gamma_state *state, const colour_setting_t *setting, int preserve) { uint32_t i; - for (i = 0; i < state->display_count; i++) quartz_apply_for_display(state, i, setting, preserve); - return 0; } -const struct gamma_method quartz_gamma_method = GAMMA_METHOD_INIT("quartz", 1, quartz); +const struct gamma_method quartz_gamma_method = GAMMA_METHOD_INIT("quartz", 1, 1, quartz); -- cgit v1.2.3-70-g09d2