options: reject invalid backend earlier
Unsupported backends were rejected when we try to initialize them, now we reject them in the option parsing phase. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
15
src/picom.c
15
src/picom.c
@ -724,13 +724,8 @@ static bool initialize_backend(session_t *ps) {
|
||||
if (ps->o.experimental_backends) {
|
||||
assert(!ps->backend_data);
|
||||
// Reinitialize win_data
|
||||
if (backend_list[ps->o.backend]) {
|
||||
ps->backend_data = backend_list[ps->o.backend]->init(ps);
|
||||
} else {
|
||||
log_error("Backend \"%s\" is not available as part of the "
|
||||
"experimental backends.",
|
||||
BACKEND_STRS[ps->o.backend]);
|
||||
}
|
||||
assert(backend_list[ps->o.backend]);
|
||||
ps->backend_data = backend_list[ps->o.backend]->init(ps);
|
||||
if (!ps->backend_data) {
|
||||
log_fatal("Failed to initialize backend, aborting...");
|
||||
quit(ps);
|
||||
@ -1751,7 +1746,11 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
|
||||
}
|
||||
|
||||
// Parse all of the rest command line options
|
||||
get_cfg(&ps->o, argc, argv, shadow_enabled, fading_enable, hasneg, winopt_mask);
|
||||
if (!get_cfg(&ps->o, argc, argv, shadow_enabled, fading_enable, hasneg, winopt_mask)) {
|
||||
log_fatal("Failed to get configuration, usually mean you have specified "
|
||||
"invalid options.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ps->o.logpath) {
|
||||
auto l = file_logger_new(ps->o.logpath);
|
||||
|
Reference in New Issue
Block a user