<div dir="ltr">Can anyone please comment on it? :)<div><br></div><div>BR</div><div>imran</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 17, 2014 at 4:11 PM, Imran Zaman <span dir="ltr"><<a href="mailto:imran.zaman@gmail.com" target="_blank">imran.zaman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nested westons (with wayland backend as child weston) is one possible<br>
use case for the needed touch support.<br>
<br>
Signed-off-by: Imran Zaman <<a href="mailto:imran.zaman@gmail.com">imran.zaman@gmail.com</a>><br>
---<br>
src/compositor-wayland.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++<br>
1 file changed, 59 insertions(+)<br>
<br>
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c<br>
index 65bce39..f125210 100644<br>
--- a/src/compositor-wayland.c<br>
+++ b/src/compositor-wayland.c<br>
@@ -1581,6 +1581,53 @@ static const struct wl_keyboard_listener keyboard_listener = {<br>
};<br>
<br>
static void<br>
+input_handle_touch_down(void *data, struct wl_touch *wl_touch,<br>
+ uint32_t serial, uint32_t time,<br>
+ struct wl_surface *surface, int32_t id, wl_fixed_t x_w,<br>
+ wl_fixed_t y_w)<br>
+{<br>
+ struct wayland_input *input = data;<br>
+ notify_touch(&input->base, time, id, x_w, y_w, WL_TOUCH_DOWN);<br>
+}<br>
+<br>
+static void<br>
+input_handle_touch_up(void *data, struct wl_touch *wl_touch,<br>
+ uint32_t serial, uint32_t time, int32_t id)<br>
+{<br>
+ struct wayland_input *input = data;<br>
+ notify_touch(&input->base, time, id, 0, 0, WL_TOUCH_UP);<br>
+}<br>
+<br>
+static void<br>
+input_handle_touch_motion(void *data, struct wl_touch *wl_touch,<br>
+ uint32_t time, int32_t id, wl_fixed_t x_w,<br>
+ wl_fixed_t y_w)<br>
+{<br>
+ struct wayland_input *input = data;<br>
+ notify_touch(&input->base, time, id, x_w, y_w, WL_TOUCH_MOTION);<br>
+}<br>
+<br>
+static void<br>
+input_handle_touch_frame(void *data, struct wl_touch *wl_touch)<br>
+{<br>
+ struct wayland_input *input = data;<br>
+ notify_touch_frame(&input->base);<br>
+}<br>
+<br>
+static void<br>
+input_handle_touch_cancel(void *data, struct wl_touch *wl_touch)<br>
+{<br>
+}<br>
+<br>
+static const struct wl_touch_listener touch_listener = {<br>
+ input_handle_touch_down,<br>
+ input_handle_touch_up,<br>
+ input_handle_touch_motion,<br>
+ input_handle_touch_frame,<br>
+ input_handle_touch_cancel,<br>
+};<br>
+<br>
+static void<br>
input_handle_capabilities(void *data, struct wl_seat *seat,<br>
enum wl_seat_capability caps)<br>
{<br>
@@ -1606,6 +1653,18 @@ input_handle_capabilities(void *data, struct wl_seat *seat,<br>
wl_keyboard_destroy(input->parent.keyboard);<br>
input->parent.keyboard = NULL;<br>
}<br>
+<br>
+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->parent.touch) {<br>
+ input->parent.touch = wl_seat_get_touch(seat);<br>
+ weston_seat_init_touch (&input->base);<br>
+ wl_touch_set_user_data(input->parent.touch, input);<br>
+ wl_touch_add_listener(input->parent.touch,<br>
+ &touch_listener, input);<br>
+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->parent.touch) {<br>
+ weston_seat_release_touch (&input->base);<br>
+ wl_touch_destroy(input->parent.touch);<br>
+ input->parent.touch = NULL;<br>
+ }<br>
}<br>
<br>
static void<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>