Add zwp-tablet-unstable-v2 client support

This allows wlroots based compositors to properly use graphic tablets
with the wayland backend.
This should be a decent quality of life improvement when working on
tablet related features.
This commit is contained in:
Markus Ongyerth 2019-05-10 08:36:19 +02:00 committed by Simon Ser
parent 57babd2e13
commit 2285e36b0c
6 changed files with 960 additions and 1 deletions

View file

@ -19,6 +19,11 @@
#include "xdg-decoration-unstable-v1-client-protocol.h"
#include "pointer-gestures-unstable-v1-client-protocol.h"
#include "xdg-shell-client-protocol.h"
#include "tablet-unstable-v2-client-protocol.h"
struct wlr_wl_tablet_seat *wlr_wl_add_tablet_seat(
struct zwp_tablet_manager_v2 *manager,
struct wl_seat *seat, struct wlr_wl_backend *backend);
struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend) {
assert(wlr_backend_is_wl(backend));
@ -81,6 +86,9 @@ static void registry_global(void *data, struct wl_registry *registry,
} else if (strcmp(iface, zwp_pointer_gestures_v1_interface.name) == 0) {
wl->zwp_pointer_gestures_v1 = wl_registry_bind(registry, name,
&zwp_pointer_gestures_v1_interface, 1);
} else if (strcmp(iface, zwp_tablet_manager_v2_interface.name) == 0) {
wl->tablet_manager = wl_registry_bind(registry, name,
&zwp_tablet_manager_v2_interface, 1);
}
}
@ -109,6 +117,11 @@ static bool backend_start(struct wlr_backend *backend) {
create_wl_keyboard(wl->keyboard, wl);
}
if (wl->tablet_manager && wl->seat) {
wlr_wl_add_tablet_seat(wl->tablet_manager,
wl->seat, wl);
}
for (size_t i = 0; i < wl->requested_outputs; ++i) {
wlr_wl_output_create(&wl->backend);
}