summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2014-01-07 18:55:14 +0000
committerChad Versace <chad.versace@linux.intel.com>2014-01-08 15:46:36 -0800
commit78f10d38b6dcffada48e392f6066504237612feb (patch)
treeb1d1be20bb31b1a6054c4bca91051f741f205a58
parentfe3bf2f1da2649109e88dbd92df40f4b495f406c (diff)
wayland: respond to ping requests from the compositor
The ping/pong protocol on the shell surface is used by the compositor to check that the client is responding to requests. This change adds a listener for the shell surface and implements the ping handler to respond to the requests from the compositor. As the wayland dispatch infrastructure does not support having NULL values for the members of the listener it is necessary to provide empty implementations for the other events that the listener handles. Signed-off-by: Rob Bradford <rob@linux.intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--src/waffle/wayland/wayland_window.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/waffle/wayland/wayland_window.c b/src/waffle/wayland/wayland_window.c
index c8986bd..f32e995 100644
--- a/src/waffle/wayland/wayland_window.c
+++ b/src/waffle/wayland/wayland_window.c
@@ -64,6 +64,35 @@ wayland_window_destroy(struct wcore_window *wc_self)
return ok;
}
+static void
+shell_surface_listener_ping(void *data,
+ struct wl_shell_surface *shell_surface,
+ uint32_t serial)
+{
+ wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+shell_surface_listener_configure(void *data,
+ struct wl_shell_surface *shell_surface,
+ uint32_t edges,
+ int32_t width,
+ int32_t height)
+{
+}
+
+static void
+shell_surface_listener_popup_done(void *data,
+ struct wl_shell_surface *shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+ .ping = shell_surface_listener_ping,
+ .configure = shell_surface_listener_configure,
+ .popup_done = shell_surface_listener_popup_done
+};
+
struct wcore_window*
wayland_window_create(struct wcore_platform *wc_plat,
struct wcore_config *wc_config,
@@ -102,6 +131,10 @@ wayland_window_create(struct wcore_platform *wc_plat,
goto error;
}
+ wl_shell_surface_add_listener(self->wl_shell_surface,
+ &shell_surface_listener,
+ NULL);
+
self->wl_window = wl_egl_window_create(self->wl_surface, width, height);
if (!self->wl_window) {
wcore_errorf(WAFFLE_ERROR_UNKNOWN, "wl_egl_window_create failed");