aboutsummaryrefslogtreecommitdiffstats
path: root/src/servers/gamma.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-17 21:20:14 +0200
committerMattias Andrée <maandree@kth.se>2016-07-17 21:20:14 +0200
commit5b804da16b09f97ad0c944daf35900a796f3bc66 (patch)
tree6da26f1f2707283a3fd00ac8effecde27addd345 /src/servers/gamma.c
parentEven more refactoring (diff)
downloadcoopgammad-5b804da16b09f97ad0c944daf35900a796f3bc66.tar.gz
coopgammad-5b804da16b09f97ad0c944daf35900a796f3bc66.tar.bz2
coopgammad-5b804da16b09f97ad0c944daf35900a796f3bc66.tar.xz
When reconnecting, reapply the ramps
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/servers/gamma.c')
-rw-r--r--src/servers/gamma.c18
1 files changed, 18 insertions, 0 deletions
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 <errno.h>
#include <string.h>
@@ -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() */
}