summaryrefslogtreecommitdiff
path: root/wayland/window.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2016-07-05 08:09:22 -0400
committerGitHub <[email protected]>2016-07-05 08:09:22 -0400
commit58804a044f782a397302173deb1416e47b3c3357 (patch)
tree9e155febd82e37ba6cb7b9e1b8ee7fda044d5147 /wayland/window.c
parentc3373c6815b5c8cff8f48d1acb46be08b9654331 (diff)
parentd9bcea381a69ebc6367aede7816b8e27d5fc9417 (diff)
Merge pull request #738 from deklov/panel-as-shell-02
Make swaybar and swaybg shell surfaces, take 2
Diffstat (limited to 'wayland/window.c')
-rw-r--r--wayland/window.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/wayland/window.c b/wayland/window.c
index ba64cb60..7ca9e4ec 100644
--- a/wayland/window.c
+++ b/wayland/window.c
@@ -59,6 +59,12 @@ static const struct wl_shell_surface_listener surface_listener = {
.configure = shell_surface_configure
};
+void window_make_shell(struct window *window) {
+ window->shell_surface = wl_shell_get_shell_surface(window->registry->shell, window->surface);
+ wl_shell_surface_add_listener(window->shell_surface, &surface_listener, window);
+ wl_shell_surface_set_toplevel(window->shell_surface);
+}
+
struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height, bool shell_surface) {
struct window *window = malloc(sizeof(struct window));
memset(window, 0, sizeof(struct window));
@@ -69,9 +75,7 @@ struct window *window_setup(struct registry *registry, uint32_t width, uint32_t
window->surface = wl_compositor_create_surface(registry->compositor);
if (shell_surface) {
- window->shell_surface = wl_shell_get_shell_surface(registry->shell, window->surface);
- wl_shell_surface_add_listener(window->shell_surface, &surface_listener, window);
- wl_shell_surface_set_toplevel(window->shell_surface);
+ window_make_shell(window);
}
if (registry->pointer) {
wl_pointer_add_listener(registry->pointer, &pointer_listener, window);