[waffle] [PATCH 2/2] wayland: respond to ping requests from the compositor
Rob Bradford
robert.bradford at intel.com
Tue Jan 7 10:55:14 PST 2014
From: Rob Bradford <rob at linux.intel.com>
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 at linux.intel.com>
---
src/waffle/wayland/wayland_window.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
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");
--
1.8.3.1
More information about the waffle
mailing list