[PATCH 1/4] xwayland: Add xwl_touch struct

Carlos Garnacho carlosg at gnome.org
Thu Oct 23 06:44:12 PDT 2014


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 b8c543c..b661921 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -576,11 +576,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 bfffa71..3920e01 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;
@@ -122,6 +129,8 @@ struct xwl_seat {
     struct xorg_list link;
     CursorPtr x_cursor;
 
+    struct xorg_list touches;
+
     wl_fixed_t horizontal_scroll;
     wl_fixed_t vertical_scroll;
     uint32_t scroll_time;
-- 
2.1.0



More information about the xorg-devel mailing list