From 5b804da16b09f97ad0c944daf35900a796f3bc66 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 17 Jul 2016 21:20:14 +0200 Subject: When reconnecting, reapply the ramps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/servers/gamma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/servers/gamma.c') diff --git a/src/servers/gamma.c b/src/servers/gamma.c index 95130e6..a481095 100644 --- a/src/servers/gamma.c +++ b/src/servers/gamma.c @@ -19,6 +19,7 @@ #include "crtc.h" #include "../state.h" #include "../communication.h" +#include "../util.h" #include #include @@ -270,9 +271,26 @@ int disconnect(void) */ int reconnect(void) { + union gamma_ramps plain; + size_t i; + if (connected) return 0; + /* Reapply gamma ramps */ + for (i = 0; i < outputs_n; i++) + { + struct output* output = outputs + i; + if (output->table_size > 0) + set_gamma(output, output->table_sums + output->table_size - 1); + else + { + make_plain_ramps(&plain, output); + set_gamma(output, &plain); + libgamma_gamma_ramps8_destroy(&(plain.u8)); + } + } + connected = 1; return 0; /* TODO reconnect() */ } -- cgit v1.2.3-70-g09d2