aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput
diff options
context:
space:
mode:
Diffstat (limited to 'backend/libinput')
-rw-r--r--backend/libinput/backend.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index 12f76bbf..7037084d 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -17,12 +17,27 @@ static struct wlr_libinput_backend *get_libinput_backend_from_backend(
static int libinput_open_restricted(const char *path,
int flags, void *_backend) {
struct wlr_libinput_backend *backend = _backend;
- return wlr_session_open_file(backend->session, path);
+ struct wlr_device *dev = wlr_session_open_file(backend->session, path);
+ if (dev == NULL) {
+ return -1;
+ }
+ return dev->fd;
}
static void libinput_close_restricted(int fd, void *_backend) {
struct wlr_libinput_backend *backend = _backend;
- wlr_session_close_file(backend->session, fd);
+
+ struct wlr_device *dev;
+ bool found = false;
+ wl_list_for_each(dev, &backend->session->devices, link) {
+ if (dev->fd == fd) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ wlr_session_close_file(backend->session, dev);
+ }
}
static const struct libinput_interface libinput_impl = {