diff options
author | Mattias Andrée <maandree@kth.se> | 2016-07-11 00:31:13 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-07-11 00:31:13 +0200 |
commit | 37777e89cd284e8cbd621969eeccc1e54972e4b0 (patch) | |
tree | fd89fac0151cd54c6dd60200d0fb187fa8b6e1c3 /src/gammad.c | |
parent | Sort outputs by name (diff) | |
download | coopgammad-37777e89cd284e8cbd621969eeccc1e54972e4b0.tar.gz coopgammad-37777e89cd284e8cbd621969eeccc1e54972e4b0.tar.bz2 coopgammad-37777e89cd284e8cbd621969eeccc1e54972e4b0.tar.xz |
Implement -p
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | src/gammad.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gammad.c b/src/gammad.c index 9d517bd..43c3586 100644 --- a/src/gammad.c +++ b/src/gammad.c @@ -325,6 +325,34 @@ int main(int argc, char** argv) break; } + /* Preserve current gamma ramps at priority=0 if -p */ + if (preserve) + for (i = 0; i < outputs_n; i++) + { + struct filter filter = { + .client = -1, + .crtc = NULL, + .priority = 0, + .class = NULL, + .lifespan = LIFESPAN_UNTIL_REMOVAL, + .ramps = NULL + }; + outputs[i].table_filters = calloc(4, sizeof(*(outputs[i].table_filters))); + outputs[i].table_sums = calloc(4, sizeof(*(outputs[i].table_sums))); + outputs[i].table_alloc = 4; + outputs[i].table_size = 1; + filter.class = memdup(PKGNAME "::" COMMAND "::preserved", sizeof(PKGNAME "::" COMMAND "::preserved")); + if (filter.class == NULL) + goto fail; + filter.ramps = memdup(outputs[i].saved_ramps.u8.red, outputs[i].ramps_size); + if (filter.ramps == NULL) + goto fail; + outputs[i].table_filters[0] = filter; + COPY_RAMP_SIZES(&(outputs[i].table_sums[0].u8), outputs + i); + if (!gamma_ramps_unmarshal(outputs[i].table_sums, outputs[i].saved_ramps.u8.red, outputs[i].ramps_size)) + goto fail; + } + /* Done */ rc = 0; done: |