[PATCH xwayland 1/4] xwayland: Add xwl_touch struct

Carlos Garnacho carlosg at gnome.org
Wed May 27 09:41:58 PDT 2015


This struct holds information about each individual, ongoing touchpoint.
A list of these is held by the xwl_seat.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 hw/xwayland/xwayland-input.c | 10 ++++++++++
 hw/xwayland/xwayland.h       |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index a6fbab5..9d355a5 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -554,11 +554,21 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id)
     xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor);
     wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat);
     wl_array_init(&xwl_seat->keys);
+
+    xorg_list_init(&xwl_seat->touches);
 }
 
 void
 xwl_seat_destroy(struct xwl_seat *xwl_seat)
 {
+    struct xwl_touch *xwl_touch, *next_xwl_touch;
+
+    xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch,
+                                  &xwl_seat->touches, link_touch) {
+        xorg_list_del(&xwl_touch->link_touch);
+        free(xwl_touch);
+    }
+
     RemoveDevice(xwl_seat->pointer, FALSE);
     RemoveDevice(xwl_seat->keyboard, FALSE);
     wl_seat_destroy(xwl_seat->seat);
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 28b0c99..3384a43 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -107,6 +107,13 @@ struct xwl_window {
 
 #define MODIFIER_META 0x01
 
+struct xwl_touch {
+    struct xwl_window *window;
+    int32_t id;
+    int x, y;
+    struct xorg_list link_touch;
+};
+
 struct xwl_seat {
     DeviceIntPtr pointer;
     DeviceIntPtr keyboard;
@@ -124,6 +131,8 @@ struct xwl_seat {
     struct wl_callback *cursor_frame_cb;
     Bool cursor_needs_update;
 
+    struct xorg_list touches;
+
     size_t keymap_size;
     char *keymap;
     struct wl_surface *keyboard_focus;
-- 
2.4.1



More information about the wayland-devel mailing list