diff options
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; |