diff options
author | 2015-11-18 22:01:22 -0500 | |
---|---|---|
committer | 2015-11-18 22:01:22 -0500 | |
commit | 82db2a57a9ab171e77a0765df5dd0b2d92cb4f70 (patch) | |
tree | 024d67d41888e4a14d7e3e281d4115e7268797fd /sway | |
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')
-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 @@ | |||
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 | } | ||
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 @@ | |||
7 | #include <sys/un.h> | 7 | #include <sys/un.h> |
8 | #include <signal.h> | 8 | #include <signal.h> |
9 | #include <getopt.h> | 9 | #include <getopt.h> |
10 | #include "extensions.h" | ||
10 | #include "layout.h" | 11 | #include "layout.h" |
11 | #include "stringop.h" | 12 | #include "stringop.h" |
12 | #include "config.h" | 13 | #include "config.h" |
@@ -73,6 +74,8 @@ int main(int argc, char **argv) { | |||
73 | if (!wlc_init(&interface, argc, argv)) { | 74 | if (!wlc_init(&interface, argc, argv)) { |
74 | return 1; | 75 | return 1; |
75 | } | 76 | } |
77 | |||
78 | register_extensions(); | ||
76 | 79 | ||
77 | char *config_path = NULL; | 80 | char *config_path = NULL; |
78 | 81 | ||