aboutsummaryrefslogtreecommitdiff
path: root/examples/compositor
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-08-15 15:33:54 +0200
committerDominique Martinet <asmadeus@codewreck.org>2017-08-15 15:36:02 +0200
commitf9b55dfa952f3e405399cabf2963b2df376f044d (patch)
treebf7a97fb514ecff64c0a151d49dc8673f5a9e921 /examples/compositor
parentd49edc8243c9ccba7a4a5dc210f87e9fba03a444 (diff)
Make wlr_wl_shell_create work like xdg
Also: - rename wlr_xdg_shell_v6_init to create as that is what it does - free wlr_xdg_shell on failure to create wl_global, the struct is not initialized enough to call destroy at that point
Diffstat (limited to 'examples/compositor')
-rw-r--r--examples/compositor/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/compositor/main.c b/examples/compositor/main.c
index 2db4199c..243b1837 100644
--- a/examples/compositor/main.c
+++ b/examples/compositor/main.c
@@ -22,7 +22,7 @@
struct sample_state {
struct wlr_renderer *renderer;
struct wl_compositor_state compositor;
- struct wlr_wl_shell wl_shell;
+ struct wlr_wl_shell *wl_shell;
struct wlr_xdg_shell_v6 *xdg_shell;
};
@@ -62,7 +62,7 @@ void handle_output_frame(struct output_state *output, struct timespec *ts) {
wlr_renderer_begin(sample->renderer, wlr_output);
struct wlr_wl_shell_surface *wl_shell_surface;
- wl_list_for_each(wl_shell_surface, &sample->wl_shell.surfaces, link) {
+ wl_list_for_each(wl_shell_surface, &sample->wl_shell->surfaces, link) {
output_frame_handle_surface(sample, wlr_output, ts, wl_shell_surface->surface);
}
struct wlr_xdg_surface_v6 *xdg_surface;
@@ -85,8 +85,11 @@ int main() {
state.renderer = wlr_gles2_renderer_init(compositor.backend);
wl_display_init_shm(compositor.display);
wl_compositor_init(compositor.display, &state.compositor, state.renderer);
- wlr_wl_shell_init(&state.wl_shell, compositor.display);
- state.xdg_shell = wlr_xdg_shell_v6_init(compositor.display);
+ state.wl_shell = wlr_wl_shell_create(compositor.display);
+ state.xdg_shell = wlr_xdg_shell_v6_create(compositor.display);
compositor_run(&compositor);
+
+ wlr_wl_shell_destroy(state.wl_shell);
+ wlr_xdg_shell_v6_destroy(state.xdg_shell);
}