summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/blueshift_quartz_c.c13
-rw-r--r--src/fake_quartz.c2
2 files changed, 14 insertions, 1 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;
diff --git a/src/fake_quartz.c b/src/fake_quartz.c
index 3fe821c..840f5b1 100644
--- a/src/fake_quartz.c
+++ b/src/fake_quartz.c
@@ -153,7 +153,7 @@ CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_si
if (gamma_size != 256)
{
- fprintf(stderr, "Gamma size should be 256\n");
+ fprintf(stderr, "Gamma size should be 256, got %u\n", gamma_size);
abort();
}