diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-18 22:01:22 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-18 22:01:22 -0500 |
commit | 82db2a57a9ab171e77a0765df5dd0b2d92cb4f70 (patch) | |
tree | 024d67d41888e4a14d7e3e281d4115e7268797fd /sway | |
parent | fb0bfa13ce8b5f71e4ba1570dd6d39f98a2f5fdf (diff) | |
download | sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.tar.xz |
Basic support for extensions in server and clients
Diffstat (limited to 'sway')
-rw-r--r-- | sway/extensions.c | 32 | ||||
-rw-r--r-- | sway/main.c | 3 |
2 files changed, 35 insertions, 0 deletions
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 <wlc/wlc.h> +#include <wlc/wlc-wayland.h> +#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); +} diff --git a/sway/main.c b/sway/main.c index 4afbccbd..ebb45930 100644 --- a/sway/main.c +++ b/sway/main.c @@ -7,6 +7,7 @@ #include <sys/un.h> #include <signal.h> #include <getopt.h> +#include "extensions.h" #include "layout.h" #include "stringop.h" #include "config.h" @@ -73,6 +74,8 @@ int main(int argc, char **argv) { if (!wlc_init(&interface, argc, argv)) { return 1; } + + register_extensions(); char *config_path = NULL; |