From d96eccc057094be31c1ee4e3b3246675934cb19d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 27 May 2015 18:41:58 +0200 Subject: [PATCH] xwayland: Add xwl_touch struct This struct holds information about each individual, ongoing touchpoint. A list of these is held by the xwl_seat. Signed-off-by: Carlos Garnacho Reviewed-by: Olivier Fourdan --- 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 4a166ef65..997b90f53 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -586,11 +586,21 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version 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); + } + wl_seat_destroy(xwl_seat->seat); wl_surface_destroy(xwl_seat->cursor); if (xwl_seat->cursor_frame_cb) diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h index cd728ca33..3c10862e0 100644 --- a/hw/xwayland/xwayland.h +++ b/hw/xwayland/xwayland.h @@ -106,6 +106,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; @@ -123,6 +130,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;