compositor-wayland: Respond to ping requests on outputs' shell surfaces
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Mon, 18 Jun 2012 14:36:21 +0000 (17:36 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 18 Jun 2012 14:59:29 +0000 (10:59 -0400)
Otherwise one can't interact with it because of the busy cursor grab.

src/compositor-wayland.c

index d498e84..fc1917d 100644 (file)
@@ -367,6 +367,8 @@ wayland_output_destroy(struct weston_output *output_base)
        return;
 }
 
+static const struct wl_shell_surface_listener shell_surface_listener;
+
 static int
 wayland_compositor_create_output(struct wayland_compositor *c,
                                 int width, int height)
@@ -428,7 +430,8 @@ wayland_compositor_create_output(struct wayland_compositor *c,
        output->parent.shell_surface =
                wl_shell_get_shell_surface(c->parent.shell,
                                           output->parent.surface);
-       /* FIXME: add shell_surface listener for resizing */
+       wl_shell_surface_add_listener(output->parent.shell_surface,
+                                     &shell_surface_listener, output);
        wl_shell_surface_set_toplevel(output->parent.shell_surface);
 
        output->base.origin = output->base.current;
@@ -454,6 +457,31 @@ cleanup_output:
        return -1;
 }
 
+static void
+shell_surface_ping(void *data, struct wl_shell_surface *shell_surface,
+                  uint32_t serial)
+{
+       wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+shell_surface_configure(void *data, struct wl_shell_surface *shell_surface,
+                       uint32_t edges, int32_t width, int32_t height)
+{
+       /* FIXME: implement resizing */
+}
+
+static void
+shell_surface_popup_done(void *data, struct wl_shell_surface *shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+       shell_surface_ping,
+       shell_surface_configure,
+       shell_surface_popup_done
+};
+
 /* Events received from the wayland-server this compositor is client of: */
 
 /* parent output interface */