[PATCH xwayland 2/7] xwayland: Bind to wp_tablet_manager if available

Carlos Garnacho carlosg at gnome.org
Fri Nov 4 20:15:12 UTC 2016


From: Jason Gerecke <killertofu at gmail.com>

If we're notified about the existance of the wp_tablet_manager interface,
we bind to it so that we can make use of any tablets that are (or later
become) available.

Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 hw/xwayland/xwayland-input.c | 12 ++++++++++++
 hw/xwayland/xwayland.h       |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 7ec3b1a..408b170 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1171,6 +1171,16 @@ xwl_seat_destroy(struct xwl_seat *xwl_seat)
     free(xwl_seat);
 }
 
+
+static void
+create_tablet_manager(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version)
+{
+    xwl_screen->tablet_manager = wl_registry_bind(xwl_screen->registry,
+                                                  id,
+                                                  &zwp_tablet_manager_v2_interface,
+                                                  min(version,1));
+}
+
 static void
 init_relative_pointer_manager(struct xwl_screen *xwl_screen,
                               uint32_t id, uint32_t version)
@@ -1204,6 +1214,8 @@ input_handler(void *data, struct wl_registry *registry, uint32_t id,
         init_relative_pointer_manager(xwl_screen, id, version);
     } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
         init_pointer_constraints(xwl_screen, id, version);
+    } else if (strcmp(interface, "zwp_tablet_manager_v2") == 0) {
+        create_tablet_manager(xwl_screen, id, version);
     }
 }
 
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 2c336e9..09a4989 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -77,6 +77,7 @@ struct xwl_screen {
     struct wl_registry *registry;
     struct wl_registry *input_registry;
     struct wl_compositor *compositor;
+    struct zwp_tablet_manager_v2 *tablet_manager;
     struct wl_shm *shm;
     struct wl_shell *shell;
     struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
@@ -138,6 +139,7 @@ struct xwl_seat {
     struct zwp_relative_pointer_v1 *wp_relative_pointer;
     struct wl_keyboard *wl_keyboard;
     struct wl_touch *wl_touch;
+    struct zwp_tablet_seat_v2 *tablet_seat;
     struct wl_array keys;
     struct xwl_window *focus_window;
     uint32_t id;
-- 
2.9.3



More information about the xorg-devel mailing list