diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-16 01:29:36 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-16 01:29:36 +0200 |
commit | 660b3e108259354b15d3c187b65550707855b5e7 (patch) | |
tree | eb4495aeccb740dc991e03f0cec16e5436155486 /src/blueshift_quartz_c.c | |
parent | add missed break (diff) | |
download | blueshift-660b3e108259354b15d3c187b65550707855b5e7.tar.gz blueshift-660b3e108259354b15d3c187b65550707855b5e7.tar.bz2 blueshift-660b3e108259354b15d3c187b65550707855b5e7.tar.xz |
missed to read gamma ramp size
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/blueshift_quartz_c.c')
-rw-r--r-- | src/blueshift_quartz_c.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/blueshift_quartz_c.c b/src/blueshift_quartz_c.c index 54f8826..19ffbe9 100644 --- a/src/blueshift_quartz_c.c +++ b/src/blueshift_quartz_c.c @@ -42,6 +42,7 @@ static uint32_t* gamma_sizes = NULL; int blueshift_quartz_open(void) { uint32_t cap = 4; + uint32_t i; CGError r; crtcs = malloc((size_t)cap * sizeof(CGDirectDisplayID)); @@ -92,6 +93,18 @@ int blueshift_quartz_open(void) close_fake_quartz(); return -1; } + for (i = 0; i < crtc_count; i++) + { + gamma_sizes[i] = CGDisplayGammaTableCapacity(crtcs[i]); + if (gamma_sizes[i] < 2) + { + fprintf(stderr, "Quartz reported impossibly small gamma ramps.\n"); + free(gamma_sizes); + free(crtcs); + close_fake_quartz(); + return -1; + } + } } return 0; |