From 2d4a5ad26bfb46b2839b176798dd1d0261cf2210 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Mon, 9 Dec 2013 10:48:45 -0500 Subject: Add dummy gamma adjustment method This method does not do anything but print the temperature to the terminal. An external program implementing a color temperature adjustment scheme that is not supported by redshift can use this method to determine the desired color temperature. It is also useful for testing other parts of redshift on systems where neither RandR nor VidMode works. --- src/gamma-dummy.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/gamma-dummy.c (limited to 'src/gamma-dummy.c') diff --git a/src/gamma-dummy.c b/src/gamma-dummy.c new file mode 100644 index 0000000..ce7033f --- /dev/null +++ b/src/gamma-dummy.c @@ -0,0 +1,76 @@ +/* gamma-randr.c -- No-op gamma adjustment + This file is part of Redshift. + + Redshift is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Redshift is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Redshift. If not, see . + + Copyright (c) 2013 Jon Lund Steffensen +*/ + +#include +#include + +#ifdef ENABLE_NLS +# include +# define _(s) gettext(s) +#else +# define _(s) s +#endif + +#include "gamma-randr.h" + + +int +gamma_dummy_init(void *state) +{ + return 0; +} + +int +gamma_dummy_start(void *state) +{ + fputs(_("WARNING: Using dummy gamma method! Display will not be affected by this gamma method.\n"), stderr); + return 0; +} + +void +gamma_dummy_restore(void *state) +{ +} + +void +gamma_dummy_free(void *state) +{ +} + +void +gamma_dummy_print_help(FILE *f) +{ + fputs(_("Does not affect the display but prints the color temperature to the terminal.\n"), f); + fputs("\n", f); +} + +int +gamma_dummy_set_option(void *state, const char *key, const char *value) +{ + fprintf(stderr, _("Unknown method parameter: `%s'.\n"), key); + return -1; +} + +int +gamma_dummy_set_temperature(void *state, int temp, float brightness, + float gamma[3]) +{ + printf(_("Temperature: %i\n"), temp); + return 0; +} -- cgit v1.2.3-70-g09d2