aboutsummaryrefslogtreecommitdiff
path: root/backend/backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/backend.c')
-rw-r--r--backend/backend.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 38b65dca..02fd7479 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -3,10 +3,15 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <libinput.h>
#include <wlr/session.h>
#include <wlr/backend/interface.h>
+#include <wlr/backend/drm.h>
+#include <wlr/backend/libinput.h>
+#include <wlr/backend/multi.h>
+#include "backend/libinput.h"
+#include "backend/udev.h"
#include "common/log.h"
-#include "backend/drm.h"
struct wlr_backend *wlr_backend_create(const struct wlr_backend_impl *impl,
struct wlr_backend_state *state) {
@@ -17,14 +22,10 @@ struct wlr_backend *wlr_backend_create(const struct wlr_backend_impl *impl,
}
backend->state = state;
backend->impl = impl;
+ wl_signal_init(&backend->events.input_add);
+ wl_signal_init(&backend->events.input_remove);
wl_signal_init(&backend->events.output_add);
wl_signal_init(&backend->events.output_remove);
- wl_signal_init(&backend->events.keyboard_add);
- wl_signal_init(&backend->events.keyboard_remove);
- wl_signal_init(&backend->events.pointer_add);
- wl_signal_init(&backend->events.pointer_remove);
- wl_signal_init(&backend->events.touch_add);
- wl_signal_init(&backend->events.touch_remove);
return backend;
}
@@ -51,12 +52,27 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
wlr_log(L_ERROR, "Failed to open DRM device");
goto error_udev;
}
- struct wlr_backend *wlr;
- wlr = wlr_drm_backend_create(display, session, udev, gpu);
- if (!wlr) {
+ struct wlr_backend *multi = wlr_multi_backend_create();
+ if (!multi) {
goto error_gpu;
}
- return wlr;
+ struct wlr_backend *libinput =
+ wlr_libinput_backend_create(display, session, udev);
+ if (!libinput) {
+ goto error_multi;
+ }
+ struct wlr_backend *drm =
+ wlr_drm_backend_create(display, session, udev, gpu);
+ if (!drm) {
+ goto error_libinput;
+ }
+ wlr_multi_backend_add(multi, libinput);
+ wlr_multi_backend_add(multi, drm);
+ return multi;
+error_libinput:
+ wlr_backend_destroy(libinput);
+error_multi:
+ wlr_backend_destroy(multi);
error_gpu:
close(gpu);
error_udev:
@@ -64,3 +80,7 @@ error_udev:
error:
return NULL;
}
+
+struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev) {
+ return dev->state->handle;
+}