wayland: register FDM hook early, to avoid unregister errors when failing

This commit is contained in:
Daniel Eklöf 2020-03-09 18:45:43 +01:00
parent 217f16e434
commit 404365ec56
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -727,6 +727,11 @@ wayl_init(const struct config *conf, struct fdm *fdm)
wayl->fdm = fdm;
wayl->kbd.repeat.fd = -1;
if (!fdm_hook_add(fdm, &fdm_hook, wayl, FDM_HOOK_PRIORITY_LOW)) {
LOG_ERR("failed to add FDM hook");
goto out;
}
wayl->display = wl_display_connect(NULL);
if (wayl->display == NULL) {
LOG_ERR("failed to connect to wayland; no compositor running?");
@ -851,11 +856,6 @@ wayl_init(const struct config *conf, struct fdm *fdm)
goto out;
}
if (!fdm_hook_add(fdm, &fdm_hook, wayl, FDM_HOOK_PRIORITY_LOW)) {
LOG_ERR("failed to add FDM hook");
goto out;
}
return wayl;
out: