diff options
author | Simon Ser <contact@emersion.fr> | 2023-08-16 22:09:01 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-08-16 22:09:01 +0200 |
commit | 22b6581a18c7b3cf10fbbc8f94c01eeffd4293f7 (patch) | |
tree | 0be2020aaa81d90133b8aa5b5152a69b9f2748b1 | |
parent | d3d3e19ffddccd1cf3c48a7076714fe10ba0c172 (diff) |
backend/wayland: wait for xdg_surface.configure explicitly
We were assuming a roundtrip was enough to get an
xdg_surface.configure event. That's not the case, the protocol
spec doesn't make such a guarantee.
-rw-r--r-- | backend/wayland/output.c | 10 | ||||
-rw-r--r-- | include/backend/wayland.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 9616c0a3..7854d476 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -718,6 +718,7 @@ static void xdg_surface_handle_configure(void *data, struct wlr_wl_output *output = data; assert(output && output->xdg_surface == xdg_surface); + output->configured = true; xdg_surface_ack_configure(xdg_surface, serial); // nothing else? @@ -868,7 +869,14 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { &xdg_toplevel_listener, output); wl_surface_commit(output->surface); - wl_display_roundtrip(output->backend->remote_display); + struct wl_event_loop *event_loop = wl_display_get_event_loop(backend->local_display); + while (!output->configured) { + int ret = wl_event_loop_dispatch(event_loop, -1); + if (ret < 0) { + wlr_log(WLR_ERROR, "wl_event_loop_dispatch() failed"); + goto error; + } + } output_start(output); diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 938e3cf7..ad04c348 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -91,6 +91,7 @@ struct wlr_wl_output { struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1; struct wl_list presentation_feedbacks; + bool configured; uint32_t enter_serial; struct { |