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 --- wayland/client.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'wayland/client.c') diff --git a/wayland/client.c b/wayland/client.c index be93709b..ab8adc47 100644 --- a/wayland/client.c +++ b/wayland/client.c @@ -1,6 +1,7 @@ #include #include #include "wayland-xdg-shell-client-protocol.h" +#include "wayland-desktop-shell-client-protocol.h" #include #include #include @@ -96,6 +97,8 @@ static void registry_global(void *data, struct wl_registry *registry, ostate->output = output; wl_output_add_listener(output, &output_listener, ostate); list_add(state->outputs, ostate); + } else if (strcmp(interface, desktop_shell_interface.name) == 0) { + state->desktop_shell = wl_registry_bind(registry, name, &desktop_shell_interface, version); } } @@ -119,7 +122,7 @@ static const struct wl_shell_surface_listener surface_listener = { .configure = shell_surface_configure }; -struct client_state *client_setup(uint32_t width, uint32_t height) { +struct client_state *client_setup(uint32_t width, uint32_t height, bool shell_surface) { struct client_state *state = malloc(sizeof(struct client_state)); memset(state, 0, sizeof(struct client_state)); state->outputs = create_list(); @@ -140,9 +143,11 @@ struct client_state *client_setup(uint32_t width, uint32_t height) { wl_registry_destroy(registry); state->surface = wl_compositor_create_surface(state->compositor); - state->shell_surface = wl_shell_get_shell_surface(state->shell, state->surface); - wl_shell_surface_add_listener(state->shell_surface, &surface_listener, state); - wl_shell_surface_set_toplevel(state->shell_surface); + if (shell_surface) { + state->shell_surface = wl_shell_get_shell_surface(state->shell, state->surface); + wl_shell_surface_add_listener(state->shell_surface, &surface_listener, state); + wl_shell_surface_set_toplevel(state->shell_surface); + } state->cursor.cursor_theme = wl_cursor_theme_load("default", 32, state->shm); // TODO: let you customize this state->cursor.cursor = wl_cursor_theme_get_cursor(state->cursor.cursor_theme, "left_ptr"); -- cgit v1.2.3-54-g00ecf