aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamma-quartz.c
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2017-10-12 18:27:41 -0700
committerJon Lund Steffensen <jonlst@gmail.com>2017-10-12 18:27:43 -0700
commite2d1b5d9cda7237a36b4e9d00b1c830045d08ca0 (patch)
tree5aa33f311768b7fe23941bb97c9d562b82123ebd /src/gamma-quartz.c
parentMerge pull request #533 from jonls/fix-error-handling (diff)
downloadredshift-ng-e2d1b5d9cda7237a36b4e9d00b1c830045d08ca0.tar.gz
redshift-ng-e2d1b5d9cda7237a36b4e9d00b1c830045d08ca0.tar.bz2
redshift-ng-e2d1b5d9cda7237a36b4e9d00b1c830045d08ca0.tar.xz
quartz: Fix incorrect use of display identifier
The quartz (macOS) adjustment method incorrectly used the display index instead of the associated CGDirectDisplayID. Incidentally this happened to work too but was incorrect.
Diffstat (limited to 'src/gamma-quartz.c')
-rw-r--r--src/gamma-quartz.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gamma-quartz.c b/src/gamma-quartz.c
index 9fcfdb8..879da21 100644
--- a/src/gamma-quartz.c
+++ b/src/gamma-quartz.c
@@ -177,10 +177,11 @@ quartz_set_option(quartz_state_t *state, const char *key, const char *value)
}
static void
-quartz_set_temperature_for_display(quartz_state_t *state, int display,
+quartz_set_temperature_for_display(quartz_state_t *state, int display_index,
const color_setting_t *setting)
{
- uint32_t ramp_size = state->displays[display].ramp_size;
+ CGDirectDisplayID display = state->displays[display_index].display;
+ uint32_t ramp_size = state->displays[display_index].ramp_size;
/* Create new gamma ramps */
float *gamma_ramps = malloc(3*ramp_size*sizeof(float));
@@ -195,7 +196,7 @@ quartz_set_temperature_for_display(quartz_state_t *state, int display,
if (state->preserve) {
/* Initialize gamma ramps from saved state */
- memcpy(gamma_ramps, state->displays[display].saved_ramps,
+ memcpy(gamma_ramps, state->displays[display_index].saved_ramps,
3*ramp_size*sizeof(float));
} else {
/* Initialize gamma ramps to pure state */