aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamma-quartz.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamma-quartz.c')
-rw-r--r--src/gamma-quartz.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/gamma-quartz.c b/src/gamma-quartz.c
index c708105..d323d33 100644
--- a/src/gamma-quartz.c
+++ b/src/gamma-quartz.c
@@ -34,15 +34,15 @@ struct gamma_state {
static int
-quartz_init(struct gamma_state **state)
+quartz_create(struct gamma_state **state_out)
{
- *state = emalloc(sizeof(**state));
- (*state)->displays = NULL;
+ *state_out = emalloc(sizeof(**state_out));
+ (*state_out)->displays = NULL;
return 0;
}
static int
-quartz_start(struct gamma_state *state, program_mode_t mode)
+quartz_start(struct gamma_state *state)
{
float *gamma_r, *gamma_g, *gamma_b;
uint32_t i, display_count, ramp_size, sample_count;
@@ -144,8 +144,7 @@ quartz_set_option(struct gamma_state *state, const char *key, const char *value)
}
static void
-quartz_set_temperature_for_display(struct gamma_state *state, int display_index,
- const colour_setting_t *setting, int preserve)
+quartz_apply_for_display(struct gamma_state *state, int display_index, const colour_setting_t *setting, int preserve)
{
float *gamma_ramps, *gamma_r, *gamma_g, *gamma_b, value;
CGDirectDisplayID display = state->displays[display_index].display;
@@ -185,25 +184,15 @@ quartz_set_temperature_for_display(struct gamma_state *state, int display_index,
}
static int
-quartz_set_temperature(
- struct gamma_state *state, const colour_setting_t *setting, int preserve)
+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_set_temperature_for_display(state, i, setting, preserve);
+ quartz_apply_for_display(state, i, setting, preserve);
return 0;
}
-const struct gamma_method quartz_gamma_method = {
- "quartz", 1,
- &quartz_init,
- &quartz_start,
- &quartz_free,
- &quartz_print_help,
- &quartz_set_option,
- &quartz_restore,
- &quartz_set_temperature
-};
+const struct gamma_method quartz_gamma_method = GAMMA_METHOD_INIT("quartz", 1, quartz);