Only start "dummy" gamma method if explicitly requested
This commit is contained in:
+6
-4
@@ -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);
|
||||
|
||||
+4
-1
@@ -14,7 +14,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Redshift. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright (c) 2010 Jon Lund Steffensen <jonlst@gmail.com>
|
||||
Copyright (c) 2013 Jon Lund Steffensen <jonlst@gmail.com>
|
||||
*/
|
||||
|
||||
#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. */
|
||||
|
||||
Reference in New Issue
Block a user