mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-05-09 05:58:13 +02:00
Merge branch 'libinput-lua-plugins' into 'master'
backend/libinput: expose libinput context (libinput plugin system) See merge request wlroots/wlroots!5354
This commit is contained in:
commit
9db73640d3
2 changed files with 20 additions and 9 deletions
|
|
@ -15,6 +15,12 @@ static struct wlr_libinput_backend *get_libinput_backend_from_backend(
|
|||
return backend;
|
||||
}
|
||||
|
||||
struct libinput *wlr_backend_get_libinput(struct wlr_backend *wlr_backend) {
|
||||
struct wlr_libinput_backend *backend =
|
||||
get_libinput_backend_from_backend(wlr_backend);
|
||||
return backend->libinput_context;
|
||||
}
|
||||
|
||||
static int libinput_open_restricted(const char *path,
|
||||
int flags, void *_backend) {
|
||||
struct wlr_libinput_backend *backend = _backend;
|
||||
|
|
@ -87,13 +93,6 @@ static bool backend_start(struct wlr_backend *wlr_backend) {
|
|||
get_libinput_backend_from_backend(wlr_backend);
|
||||
wlr_log(WLR_DEBUG, "Starting libinput backend");
|
||||
|
||||
backend->libinput_context = libinput_udev_create_context(&libinput_impl,
|
||||
backend, backend->session->udev);
|
||||
if (!backend->libinput_context) {
|
||||
wlr_log(WLR_ERROR, "Failed to create libinput context");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (libinput_udev_assign_seat(backend->libinput_context,
|
||||
backend->session->seat) != 0) {
|
||||
wlr_log(WLR_ERROR, "Failed to assign libinput seat");
|
||||
|
|
@ -187,12 +186,20 @@ struct wlr_backend *wlr_libinput_backend_create(struct wlr_session *session) {
|
|||
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wlr_backend_init(&backend->backend, &backend_impl);
|
||||
|
||||
wl_list_init(&backend->devices);
|
||||
|
||||
backend->session = session;
|
||||
|
||||
backend->libinput_context = libinput_udev_create_context(&libinput_impl,
|
||||
backend, backend->session->udev);
|
||||
if (!backend->libinput_context) {
|
||||
wlr_log(WLR_ERROR, "Failed to create libinput context");
|
||||
wlr_backend_finish(&backend->backend);
|
||||
free(backend);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
backend->session_signal.notify = session_signal;
|
||||
wl_signal_add(&session->events.active, &backend->session_signal);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ struct libinput_device *wlr_libinput_get_device_handle(
|
|||
*/
|
||||
struct libinput_tablet_tool *wlr_libinput_get_tablet_tool_handle(
|
||||
struct wlr_tablet_tool *wlr_tablet_tool);
|
||||
/**
|
||||
* Gets the underlying struct libinput for direct access to the libinput context.
|
||||
*/
|
||||
struct libinput *wlr_backend_get_libinput(struct wlr_backend *wlr_backend);
|
||||
|
||||
bool wlr_backend_is_libinput(const struct wlr_backend *backend);
|
||||
bool wlr_input_device_is_libinput(struct wlr_input_device *device);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue