diff options
Diffstat (limited to 'wayland')
-rw-r--r-- | wayland/window.c | 10 |
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 | ||
62 | void 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 | |||
62 | struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height, bool shell_surface) { | 68 | struct 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); |