From 1ea4a4d1968b767912e70e18be8f0e1e22bf9c6f Mon Sep 17 00:00:00 2001
From: Mattias Andrée <m@maandree.se>
Date: Sun, 23 Mar 2025 15:08:45 +0100
Subject: Use libgamma to determine available adjustment method configuration
 options
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <m@maandree.se>
---
 src/gamma-randr.c | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

(limited to 'src/gamma-randr.c')

diff --git a/src/gamma-randr.c b/src/gamma-randr.c
index 1132960..5580a4f 100644
--- a/src/gamma-randr.c
+++ b/src/gamma-randr.c
@@ -32,33 +32,13 @@ randr_print_help(FILE *f)
 {
 	fputs(_("Adjust gamma ramps with the X RANDR extension.\n"), f);
 	fputs("\n", f);
-
-	/* TRANSLATORS: RANDR help output left column must not be translated */
-	fputs(_("  screen=N      X screen to apply adjustments to\n"), f);
-	fputs(_("  crtc=N        List of comma-separated CRTCs to apply adjustments to\n"), f);
-	fputs("\n", f);
-}
-
-
-static int
-randr_set_option(struct gamma_state *state, const char *key, const char *value)
-{
-	if (!strcasecmp(key, "screen")) {
-		return direct_set_partitions(state, key, value);
-	} else if (!strcasecmp(key, "crtc")) {
-		return direct_set_crtcs(state, key, value);
-	} else if (!strcasecmp(key, "preserve")) {
-		weprintf(_("Deprecated method parameter ignored: `%s'."), key);
-		return 0;
-	} else {
-		weprintf(_("Unknown method parameter: `%s'."), key);
-		return -1;
-	}
+	direct_print_help(f, LIBGAMMA_METHOD_X_RANDR);
 }
 
 
-#define randr_start    direct_start
-#define randr_apply    direct_apply
-#define randr_restore  direct_restore
-#define randr_free     direct_free
+#define randr_set_option  direct_set_option
+#define randr_start       direct_start
+#define randr_apply       direct_apply
+#define randr_restore     direct_restore
+#define randr_free        direct_free
 const struct gamma_method randr_gamma_method = GAMMA_METHOD_INIT("randr", 1, 0, randr);
-- 
cgit v1.2.3-70-g09d2