mirror of
https://github.com/emersion/wlr-randr
synced 2024-11-22 19:41:57 +01:00
Add --preferred
This commit is contained in:
parent
1cc82e6950
commit
0506286f24
21
main.c
21
main.c
@ -374,6 +374,7 @@ static const struct option long_options[] = {
|
||||
{"on", no_argument, 0, 0},
|
||||
{"off", no_argument, 0, 0},
|
||||
{"mode", required_argument, 0, 0},
|
||||
{"preferred", no_argument, 0, 0},
|
||||
{"custom-mode", required_argument, 0, 0},
|
||||
{"pos", required_argument, 0, 0},
|
||||
{"transform", required_argument, 0, 0},
|
||||
@ -486,6 +487,25 @@ static bool parse_output_arg(struct randr_head *head,
|
||||
return false;
|
||||
}
|
||||
|
||||
head->mode = mode;
|
||||
head->custom_mode.width = 0;
|
||||
head->custom_mode.height = 0;
|
||||
head->custom_mode.refresh = 0;
|
||||
} else if (strcmp(name, "preferred") == 0) {
|
||||
bool found = false;
|
||||
struct randr_mode *mode;
|
||||
wl_list_for_each(mode, &head->modes, link) {
|
||||
if (mode->preferred) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
fprintf(stderr, "no preferred mode found\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
head->mode = mode;
|
||||
head->custom_mode.width = 0;
|
||||
head->custom_mode.height = 0;
|
||||
@ -559,6 +579,7 @@ static const char usage[] =
|
||||
" --on\n"
|
||||
" --off\n"
|
||||
" --mode|--custom-mode <width>x<height>[@<refresh>Hz]\n"
|
||||
" --preferred\n"
|
||||
" --pos <x>,<y>\n"
|
||||
" --transform normal|90|180|270|flipped|flipped-90|flipped-180|flipped-270\n"
|
||||
" --scale <factor>\n";
|
||||
|
Loading…
Reference in New Issue
Block a user