First wl_surface_commit after unmapping doesn't trigger xdg_surface_configure
I'm working on an xdg-shell client which needs to hide/show its xdg_toplevel
on demand.
I can hide just fine:
wl_surface_attach(wl_surface, NULL, 0, 0);
wl_surface_commit(wl_surface);
However, I'm struggling to show the toplevel back again. From the protocol doc (emphasis mine):
Unmapping an xdg_toplevel means that the surface cannot be shown by the compositor until it is explicitly mapped again. [...] The xdg_toplevel returns to the state it had right after xdg_surface.get_toplevel. The client can re-map the toplevel by perfoming a commit without any buffer attached, waiting for a configure event and handling it as usual (see xdg_surface description).
Therefore, I'm assuming I should just do this:
wl_surface_commit(wl_surface);
...and wait for xdg_surface_configure
before attaching the buffer.
However, in Weston, the xdg_surface_configure
event doesn't arrive after this.
OTOH, It is possible to show the toplevel by just attaching the buffer, without waiting for anything:
struct wl_buffer *wl_buffer = draw_frame();
wl_surface_attach(wl_surface, wl_buffer, 0, 0);
wl_surface_commit(wl_surface);
/*
* This just works and triggers the xdg_surface_configure as well.
* However, it violates the "commit without any buffer attached" rule.
*/
I compared the behavior in sway
and it does trigger xdg_surface_configure
after that initial commit
without a buffer.
Perhaps I'm misunderstanding the expected behavior here. I'd appreciate some clarification if that's the case.
A minimal project to reproduce the behavior: https://github.com/czak/showhide
Thanks!