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/extensions.c | |
parent | Fix warning about uninitialized variable (diff) | |
download | sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.tar.gz sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.tar.zst sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.zip |
Basic support for extensions in server and clients
Diffstat (limited to 'sway/extensions.c')
-rw-r--r-- | sway/extensions.c | 32 |
1 files changed, 32 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 @@ | |||
1 | #include <wlc/wlc.h> | ||
2 | #include <wlc/wlc-wayland.h> | ||
3 | #include "wayland-desktop-shell-server-protocol.h" | ||
4 | #include "log.h" | ||
5 | |||
6 | static void set_background(struct wl_client *client, struct wl_resource *resource, | ||
7 | struct wl_resource *output, struct wl_resource *surface) { | ||
8 | sway_log(L_DEBUG, "Surface requesting background for output"); | ||
9 | } | ||
10 | |||
11 | static struct desktop_shell_interface desktop_shell_implementation = { | ||
12 | .set_background = set_background, | ||
13 | }; | ||
14 | |||
15 | static void desktop_shell_bind(struct wl_client *client, void *data, | ||
16 | unsigned int version, unsigned int id) { | ||
17 | if (version > 1) { | ||
18 | // Unsupported version | ||
19 | return; | ||
20 | } | ||
21 | |||
22 | struct wl_resource *resource = wl_resource_create(client, &desktop_shell_interface, version, id); | ||
23 | if (!resource) { | ||
24 | wl_client_post_no_memory(client); | ||
25 | } | ||
26 | |||
27 | wl_resource_set_implementation(resource, &desktop_shell_implementation, NULL, NULL); | ||
28 | } | ||
29 | |||
30 | void register_extensions(void) { | ||
31 | wl_global_create(wlc_get_wl_display(), &desktop_shell_interface, 1, NULL, desktop_shell_bind); | ||
32 | } | ||