From d0070071914d2a7f9a3a9a0779adb7483440c00e Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Mon, 9 Dec 2013 14:32:08 -0500 Subject: Only start "dummy" gamma method if explicitly requested --- src/redshift.c | 10 ++++++---- src/redshift.h | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/redshift.c b/src/redshift.c index 7352ab2..af76e67 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -91,7 +91,7 @@ typedef union { static const gamma_method_t gamma_methods[] = { #ifdef ENABLE_RANDR { - "randr", + "randr", 1, (gamma_method_init_func *)randr_init, (gamma_method_start_func *)randr_start, (gamma_method_free_func *)randr_free, @@ -103,7 +103,7 @@ static const gamma_method_t gamma_methods[] = { #endif #ifdef ENABLE_VIDMODE { - "vidmode", + "vidmode", 1, (gamma_method_init_func *)vidmode_init, (gamma_method_start_func *)vidmode_start, (gamma_method_free_func *)vidmode_free, @@ -115,7 +115,7 @@ static const gamma_method_t gamma_methods[] = { #endif #ifdef ENABLE_WINGDI { - "wingdi", + "wingdi", 1, (gamma_method_init_func *)w32gdi_init, (gamma_method_start_func *)w32gdi_start, (gamma_method_free_func *)w32gdi_free, @@ -126,7 +126,7 @@ static const gamma_method_t gamma_methods[] = { }, #endif { - "dummy", + "dummy", 0, (gamma_method_init_func *)gamma_dummy_init, (gamma_method_start_func *)gamma_dummy_start, (gamma_method_free_func *)gamma_dummy_free, @@ -1067,6 +1067,8 @@ main(int argc, char *argv[]) /* Try all methods, use the first that works. */ for (int i = 0; gamma_methods[i].name != NULL; i++) { const gamma_method_t *m = &gamma_methods[i]; + if (!m->autostart) continue; + r = method_try_start(m, &state, &config_state, NULL); if (r < 0) { fputs(_("Trying next method...\n"), stderr); diff --git a/src/redshift.h b/src/redshift.h index a7489ce..c284fc1 100644 --- a/src/redshift.h +++ b/src/redshift.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with Redshift. If not, see . - Copyright (c) 2010 Jon Lund Steffensen + Copyright (c) 2013 Jon Lund Steffensen */ #ifndef _REDSHIFT_REDSHIFT_H @@ -39,6 +39,9 @@ typedef int gamma_method_set_temperature_func(void *state, int temp, typedef struct { char *name; + /* If true, this method will be tried if none is explicitly chosen. */ + int autostart; + /* Initialize state. Options can be set between init and start. */ gamma_method_init_func *init; /* Allocate storage and make connections that depend on options. */ -- cgit v1.2.3-70-g09d2