[PATCH weston 01/17] simple-touch: respond to ping protocol

Pekka Paalanen ppaalanen at gmail.com
Thu Jul 5 03:32:58 PDT 2012


Without this, it won't get any input anymore.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 clients/simple-touch.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/clients/simple-touch.c b/clients/simple-touch.c
index 517a956..b438ffa 100644
--- a/clients/simple-touch.c
+++ b/clients/simple-touch.c
@@ -200,6 +200,30 @@ static const struct wl_seat_listener seat_listener = {
 };
 
 static void
+handle_ping(void *data, struct wl_shell_surface *shell_surface,
+	    uint32_t serial)
+{
+	wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+handle_configure(void *data, struct wl_shell_surface *shell_surface,
+		 uint32_t edges, int32_t width, int32_t height)
+{
+}
+
+static void
+handle_popup_done(void *data, struct wl_shell_surface *shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+	handle_ping,
+	handle_configure,
+	handle_popup_done
+};
+
+static void
 handle_global(struct wl_display *display, uint32_t id,
 	      const char *interface, uint32_t version, void *data)
 {
@@ -258,7 +282,12 @@ touch_create(int width, int height)
 							  touch->surface);
 	create_shm_buffer(touch);
 
-	wl_shell_surface_set_toplevel(touch->shell_surface);
+	if (touch->shell_surface) {
+		wl_shell_surface_add_listener(touch->shell_surface,
+					      &shell_surface_listener, touch);
+		wl_shell_surface_set_toplevel(touch->shell_surface);
+	}
+
 	wl_surface_set_user_data(touch->surface, touch);
 
 	memset(touch->data, 64, width * height * 4);
-- 
1.7.8.6



More information about the wayland-devel mailing list