diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-08-09 07:27:49 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-08-09 12:31:16 -0400 |
commit | a6c7d8d14f2f418eeb066b5062f031ee4ebeda82 (patch) | |
tree | 82bec02e812ae2e21a688719594e9b934c0f2145 /examples | |
parent | 5add87cac602b4fb8a484f42707165d1e2ad8d89 (diff) |
send configure event after creating toplevel
The xdg shell protocol requires us to send a configure in order for the client
to start attaching buffers.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/compositor.h | 1 | ||||
-rw-r--r-- | examples/compositor/xdg_shell.c | 14 |
2 files changed, 11 insertions, 4 deletions
diff --git a/examples/compositor.h b/examples/compositor.h index 5d652dbe..7d786127 100644 --- a/examples/compositor.h +++ b/examples/compositor.h @@ -22,6 +22,7 @@ struct wl_shell_state { struct xdg_shell_state { struct wl_global *wl_global; struct wl_list wl_resources; + struct wl_display *display; }; void wl_shell_init(struct wl_display *display, diff --git a/examples/compositor/xdg_shell.c b/examples/compositor/xdg_shell.c index 5d0d9e8d..4933b9e4 100644 --- a/examples/compositor/xdg_shell.c +++ b/examples/compositor/xdg_shell.c @@ -89,6 +89,12 @@ static const struct zxdg_toplevel_v6_interface zxdg_toplevel_v6_implementation = .set_minimized = xdg_toplevel_set_minimized }; +struct xdg_surface_state { + struct wlr_texture *wlr_texture; + struct wl_display *display; +}; + + static void xdg_surface_destroy(struct wl_client *client, struct wl_resource *resource) { wlr_log(L_DEBUG, "TODO xdg surface destroy"); @@ -106,6 +112,7 @@ static void xdg_surface_get_toplevel(struct wl_client *client, &zxdg_toplevel_v6_interface, wl_resource_get_version(resource), id); wl_resource_set_implementation(toplevel_resource, &zxdg_toplevel_v6_implementation, state, destroy_xdg_shell_surface); + zxdg_surface_v6_send_configure(resource, wl_display_next_serial(state->display)); } static void xdg_surface_get_popup(struct wl_client *client, @@ -134,10 +141,6 @@ static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = { .set_window_geometry = xdg_surface_set_window_geometry, }; -struct xdg_surface_state { - struct wlr_texture *wlr_texture; -}; - static void xdg_shell_destroy(struct wl_client *client, struct wl_resource *resource) { wlr_log(L_DEBUG, "TODO: xdg shell destroy"); @@ -151,8 +154,10 @@ static void xdg_shell_create_positioner(struct wl_client *client, static void xdg_shell_get_xdg_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource) { + struct xdg_shell_state *shell_state = wl_resource_get_user_data(resource); struct wlr_texture *wlr_texture = wl_resource_get_user_data(surface_resource); struct xdg_surface_state *state = malloc(sizeof(struct xdg_surface_state)); + state->display = shell_state->display; state->wlr_texture = wlr_texture; struct wl_resource *shell_surface_resource = wl_resource_create(client, &zxdg_surface_v6_interface, wl_resource_get_version(resource), id); @@ -203,5 +208,6 @@ void xdg_shell_init(struct wl_display *display, struct xdg_shell_state *state) { struct wl_global *wl_global = wl_global_create(display, &zxdg_shell_v6_interface, 1, state, xdg_shell_bind); state->wl_global = wl_global; + state->display = display; wl_list_init(&state->wl_resources); } |