aboutsummaryrefslogtreecommitdiffstats
path: root/src/servers/crtc.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-18 14:47:22 +0200
committerMattias Andrée <maandree@kth.se>2016-07-18 14:47:22 +0200
commit169ad0abf4409cbc55d2358210ff61f76aa82fb7 (patch)
treee56ca056c9924f964bd9988404523d2e96d4476b /src/servers/crtc.c
parentm diagnostics (diff)
downloadcoopgammad-169ad0abf4409cbc55d2358210ff61f76aa82fb7.tar.gz
coopgammad-169ad0abf4409cbc55d2358210ff61f76aa82fb7.tar.bz2
coopgammad-169ad0abf4409cbc55d2358210ff61f76aa82fb7.tar.xz
Implement disconnect
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/servers/crtc.c')
-rw-r--r--src/servers/crtc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/servers/crtc.c b/src/servers/crtc.c
index df274f8..96e3a84 100644
--- a/src/servers/crtc.c
+++ b/src/servers/crtc.c
@@ -205,11 +205,24 @@ int merge_state(struct output* restrict old_outputs, size_t old_outputs_n)
*/
int disconnect(void)
{
+ size_t i;
+
if (!connected)
return 0;
connected = 0;
- return 0; /* TODO disconnect() */
+ for (i = 0; i < outputs_n; i++)
+ {
+ outputs[i].crtc = NULL;
+ libgamma_crtc_destroy(crtcs + i);
+ }
+ free(crtcs), crtcs = NULL;
+ for (i = 0; i < site.partitions_available; i++)
+ libgamma_partition_destroy(partitions + i);
+ free(partitions), partitions = NULL;
+ libgamma_site_destroy(&site);
+
+ return 0;
}