From 82db2a57a9ab171e77a0765df5dd0b2d92cb4f70 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 18 Nov 2015 22:01:22 -0500 Subject: Basic support for extensions in server and clients --- sway/extensions.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sway/extensions.c (limited to 'sway/extensions.c') diff --git a/sway/extensions.c b/sway/extensions.c new file mode 100644 index 00000000..a37ceaa8 --- /dev/null +++ b/sway/extensions.c @@ -0,0 +1,32 @@ +#include +#include +#include "wayland-desktop-shell-server-protocol.h" +#include "log.h" + +static void set_background(struct wl_client *client, struct wl_resource *resource, + struct wl_resource *output, struct wl_resource *surface) { + sway_log(L_DEBUG, "Surface requesting background for output"); +} + +static struct desktop_shell_interface desktop_shell_implementation = { + .set_background = set_background, +}; + +static void desktop_shell_bind(struct wl_client *client, void *data, + unsigned int version, unsigned int id) { + if (version > 1) { + // Unsupported version + return; + } + + struct wl_resource *resource = wl_resource_create(client, &desktop_shell_interface, version, id); + if (!resource) { + wl_client_post_no_memory(client); + } + + wl_resource_set_implementation(resource, &desktop_shell_implementation, NULL, NULL); +} + +void register_extensions(void) { + wl_global_create(wlc_get_wl_display(), &desktop_shell_interface, 1, NULL, desktop_shell_bind); +} -- cgit v1.2.3