aboutsummaryrefslogtreecommitdiffstats
path: root/libgamma_dummy_site_restore.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgamma_dummy_site_restore.c')
-rw-r--r--libgamma_dummy_site_restore.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libgamma_dummy_site_restore.c b/libgamma_dummy_site_restore.c
new file mode 100644
index 0000000..566a7f3
--- /dev/null
+++ b/libgamma_dummy_site_restore.c
@@ -0,0 +1,29 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+/**
+ * Restore the gamma ramps all CRTC:s with a site to the system settings
+ *
+ * @param this The site state
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library
+ */
+int
+libgamma_dummy_site_restore(libgamma_site_state_t *restrict this)
+{
+ libgamma_dummy_site_t *data = this->data;
+ size_t i, j;
+
+ if (!libgamma_dummy_internal_configurations.capabilities.site_restore) {
+ errno = ENOTSUP;
+ return LIBGAMMA_ERRNO_SET;
+ }
+
+ for (j = 0; j < data->partition_count; j++)
+ for (i = 0; i < data->partitions[j].crtc_count; i++)
+ if (libgamma_dummy_internal_crtc_restore_forced(data->partitions[j].crtcs + i) < 0)
+ return -1;
+
+ return 0;
+}