summaryrefslogtreecommitdiffstats
path: root/wayland
diff options
context:
space:
mode:
authorLibravatar David Eklov <david.eklov@gmail.com>2016-07-04 17:01:37 -0500
committerLibravatar David Eklov <david.eklov@gmail.com>2016-07-04 21:58:41 -0500
commitbb35960e652f98a882ed3cd2d1968b860942b896 (patch)
tree28a5b8207a166c24a636cfcf25448baa446d2943 /wayland
parentEnable backgrounds and panels to be shell surfaces (diff)
downloadsway-bb35960e652f98a882ed3cd2d1968b860942b896.tar.gz
sway-bb35960e652f98a882ed3cd2d1968b860942b896.tar.zst
sway-bb35960e652f98a882ed3cd2d1968b860942b896.zip
Move code to make a window a shell surface into seperate function
Diffstat (limited to 'wayland')
-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 = {
59 .configure = shell_surface_configure 59 .configure = shell_surface_configure
60}; 60};
61 61
62void window_make_shell(struct window *window) {
63 window->shell_surface = wl_shell_get_shell_surface(window->registry->shell, window->surface);
64 wl_shell_surface_add_listener(window->shell_surface, &surface_listener, window);
65 wl_shell_surface_set_toplevel(window->shell_surface);
66}
67
62struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height, bool shell_surface) { 68struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height, bool shell_surface) {
63 struct window *window = malloc(sizeof(struct window)); 69 struct window *window = malloc(sizeof(struct window));
64 memset(window, 0, sizeof(struct window)); 70 memset(window, 0, sizeof(struct window));
@@ -69,9 +75,7 @@ struct window *window_setup(struct registry *registry, uint32_t width, uint32_t
69 75
70 window->surface = wl_compositor_create_surface(registry->compositor); 76 window->surface = wl_compositor_create_surface(registry->compositor);
71 if (shell_surface) { 77 if (shell_surface) {
72 window->shell_surface = wl_shell_get_shell_surface(registry->shell, window->surface); 78 window_make_shell(window);
73 wl_shell_surface_add_listener(window->shell_surface, &surface_listener, window);
74 wl_shell_surface_set_toplevel(window->shell_surface);
75 } 79 }
76 if (registry->pointer) { 80 if (registry->pointer) {
77 wl_pointer_add_listener(registry->pointer, &pointer_listener, window); 81 wl_pointer_add_listener(registry->pointer, &pointer_listener, window);