diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-08-16 07:22:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 07:22:36 -0400 |
commit | 3ac10a81bde8fd7fa5135053fb0a6ffac61d4721 (patch) | |
tree | 9daa0e18118a0c9bc67d035732e6588e19f95749 /backend | |
parent | 2164adc5136e91e5d9d5d0f67f792185f1c66658 (diff) | |
parent | 880c239657bc81d244ae8fd3371b7b8a21bc8f07 (diff) |
Merge pull request #94 from martinetd/libinput_no_device
libinput: fail if no input found on init
Diffstat (limited to 'backend')
-rw-r--r-- | backend/libinput/backend.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index a8f43fbc..7dc1cc01 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -63,14 +63,22 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { libinput_log_set_handler(backend->libinput_context, wlr_libinput_log); libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR); + int libinput_fd = libinput_get_fd(backend->libinput_context); + if (backend->wlr_device_lists->length == 0) { + wlr_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend); + if (backend->wlr_device_lists->length == 0) { + wlr_log(L_ERROR, "No input device found, failing initialization"); + return false; + } + } + struct wl_event_loop *event_loop = wl_display_get_event_loop(backend->display); if (backend->input_event) { wl_event_source_remove(backend->input_event); } - backend->input_event = wl_event_loop_add_fd(event_loop, - libinput_get_fd(backend->libinput_context), WL_EVENT_READABLE, - wlr_libinput_readable, backend); + backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd, + WL_EVENT_READABLE, wlr_libinput_readable, backend); if (!backend->input_event) { wlr_log(L_ERROR, "Failed to create input event on event loop"); return false; |