diff options
Diffstat (limited to 'wayland')
-rw-r--r-- | wayland/client.c | 13 |
1 files changed, 9 insertions, 4 deletions
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 @@ | |||
1 | #include <wayland-client.h> | 1 | #include <wayland-client.h> |
2 | #include <wayland-cursor.h> | 2 | #include <wayland-cursor.h> |
3 | #include "wayland-xdg-shell-client-protocol.h" | 3 | #include "wayland-xdg-shell-client-protocol.h" |
4 | #include "wayland-desktop-shell-client-protocol.h" | ||
4 | #include <cairo/cairo.h> | 5 | #include <cairo/cairo.h> |
5 | #include <pango/pangocairo.h> | 6 | #include <pango/pangocairo.h> |
6 | #include <stdlib.h> | 7 | #include <stdlib.h> |
@@ -96,6 +97,8 @@ static void registry_global(void *data, struct wl_registry *registry, | |||
96 | ostate->output = output; | 97 | ostate->output = output; |
97 | wl_output_add_listener(output, &output_listener, ostate); | 98 | wl_output_add_listener(output, &output_listener, ostate); |
98 | list_add(state->outputs, ostate); | 99 | list_add(state->outputs, ostate); |
100 | } else if (strcmp(interface, desktop_shell_interface.name) == 0) { | ||
101 | state->desktop_shell = wl_registry_bind(registry, name, &desktop_shell_interface, version); | ||
99 | } | 102 | } |
100 | } | 103 | } |
101 | 104 | ||
@@ -119,7 +122,7 @@ static const struct wl_shell_surface_listener surface_listener = { | |||
119 | .configure = shell_surface_configure | 122 | .configure = shell_surface_configure |
120 | }; | 123 | }; |
121 | 124 | ||
122 | struct client_state *client_setup(uint32_t width, uint32_t height) { | 125 | struct client_state *client_setup(uint32_t width, uint32_t height, bool shell_surface) { |
123 | struct client_state *state = malloc(sizeof(struct client_state)); | 126 | struct client_state *state = malloc(sizeof(struct client_state)); |
124 | memset(state, 0, sizeof(struct client_state)); | 127 | memset(state, 0, sizeof(struct client_state)); |
125 | state->outputs = create_list(); | 128 | state->outputs = create_list(); |
@@ -140,9 +143,11 @@ struct client_state *client_setup(uint32_t width, uint32_t height) { | |||
140 | wl_registry_destroy(registry); | 143 | wl_registry_destroy(registry); |
141 | 144 | ||
142 | state->surface = wl_compositor_create_surface(state->compositor); | 145 | state->surface = wl_compositor_create_surface(state->compositor); |
143 | state->shell_surface = wl_shell_get_shell_surface(state->shell, state->surface); | 146 | if (shell_surface) { |
144 | wl_shell_surface_add_listener(state->shell_surface, &surface_listener, state); | 147 | state->shell_surface = wl_shell_get_shell_surface(state->shell, state->surface); |
145 | wl_shell_surface_set_toplevel(state->shell_surface); | 148 | wl_shell_surface_add_listener(state->shell_surface, &surface_listener, state); |
149 | wl_shell_surface_set_toplevel(state->shell_surface); | ||
150 | } | ||
146 | 151 | ||
147 | state->cursor.cursor_theme = wl_cursor_theme_load("default", 32, state->shm); // TODO: let you customize this | 152 | state->cursor.cursor_theme = wl_cursor_theme_load("default", 32, state->shm); // TODO: let you customize this |
148 | state->cursor.cursor = wl_cursor_theme_get_cursor(state->cursor.cursor_theme, "left_ptr"); | 153 | state->cursor.cursor = wl_cursor_theme_get_cursor(state->cursor.cursor_theme, "left_ptr"); |