aboutsummaryrefslogtreecommitdiffstats
path: root/fake-quartz-cg.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-03-07 22:51:21 +0100
committerMattias Andrée <maandree@kth.se>2021-03-07 22:51:21 +0100
commitbaa6a1cf7979c095c1081daa2a2d1134c76d2f1b (patch)
treed0525238a334091eb4d241b0b83da1a4a1793d5b /fake-quartz-cg.c
parentStart replacing info manual with man pages (diff)
downloadlibgamma-baa6a1cf7979c095c1081daa2a2d1134c76d2f1b.tar.gz
libgamma-baa6a1cf7979c095c1081daa2a2d1134c76d2f1b.tar.bz2
libgamma-baa6a1cf7979c095c1081daa2a2d1134c76d2f1b.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'fake-quartz-cg.c')
-rw-r--r--fake-quartz-cg.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fake-quartz-cg.c b/fake-quartz-cg.c
index 34d3995..b0cc574 100644
--- a/fake-quartz-cg.c
+++ b/fake-quartz-cg.c
@@ -227,7 +227,7 @@ CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID *restrict displays_o
* `CGDisplayRestoreColorSyncSettings` which restore the
* all gamma ramps on the system to the system settnigs.
*/
- original_ramps = malloc(crtc_count * 3 * 256 * sizeof(uint16_t));
+ original_ramps = malloc(crtc_count * 3 * 256 * sizeof(*original_ramps));
if (!original_ramps) {
perror("malloc");
xcb_disconnect(connection);
@@ -248,13 +248,12 @@ CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID *restrict displays_o
}
/* Copy over the gamma ramps to the memory area we have allocated */
-#define __DEST(C) original_ramps + (C + 3 * i) * 256
-#define __SRC(C) xcb_randr_get_crtc_gamma_##C(gamma_reply)
- memcpy(__DEST(0), __SRC(red), 256 * sizeof(uint16_t));
- memcpy(__DEST(1), __SRC(green), 256 * sizeof(uint16_t));
- memcpy(__DEST(2), __SRC(blue), 256 * sizeof(uint16_t));
-#undef __SRC
-#undef __DEST
+ memcpy(&original_ramps[(3 * i + 0) * 256], xcb_randr_get_crtc_gamma_red(gamma_reply)
+ 256 * sizeof(*original_ramps));
+ memcpy(&original_ramps[(3 * i + 1) * 256], xcb_randr_get_crtc_gamma_green(gamma_reply),
+ 256 * sizeof(*original_ramps));
+ memcpy(&original_ramps[(3 * i + 2) * 256], xcb_randr_get_crtc_gamma_blue(gamma_reply),
+ 256 * sizeof(*original_ramps));
/* Release resouces */
free(gamma_reply);