diff options
Diffstat (limited to 'src/redshift.c')
-rw-r--r-- | src/redshift.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/redshift.c b/src/redshift.c index c553abb..abb0bfd 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -216,12 +216,12 @@ print_help(const char *program_name) fputs(_(" -g R:G:B\tAdditional gamma correction to apply\n" " -l LAT:LON\tYour current location\n" " -m METHOD\tMethod to use to set color temperature" - " (randr or vidmode)\n" + " (RANDR or VidMode)\n" " -o\t\tOne shot mode (do not continously adjust" " color temperature)\n" " -r\t\tDisable initial temperature transition\n" " -s SCREEN\tX screen to apply adjustments to\n" - " -c CRTC\tCRTC to apply adjustments to (randr only)\n" + " -c CRTC\tCRTC to apply adjustments to (RANDR only)\n" " -t DAY:NIGHT\tColor temperature to set at daytime/night\n"), stdout); fputs("\n", stdout); @@ -262,8 +262,11 @@ main(int argc, char *argv[]) /* Parse arguments. */ int opt; - while ((opt = getopt(argc, argv, "g:hl:m:ors:c:t:v")) != -1) { + while ((opt = getopt(argc, argv, "c:g:hl:m:ors:t:v")) != -1) { switch (opt) { + case 'c': + crtc_num = atoi(optarg); + break; case 'g': s = strchr(optarg, ':'); if (s == NULL) { @@ -344,9 +347,6 @@ main(int argc, char *argv[]) case 's': screen_num = atoi(optarg); break; - case 'c': - crtc_num = atoi(optarg); - break; case 't': s = strchr(optarg, ':'); if (s == NULL) { @@ -431,6 +431,13 @@ main(int argc, char *argv[]) gamma[0], gamma[1], gamma[2]); } + /* CRTC can only be selected for RANDR */ + if (crtc_num > -1 && !use_randr) { + fprintf(stderr, _("CRTC can only be selected" + " with the RANDR method.\n")); + exit(EXIT_FAILURE); + } + /* Initialize gamma adjustment method. If use_randr is negative try all methods until one that works is found. */ gamma_state_t state; |