backend/wayland: avoid nested calls to wl_display_dispatch
See #3920 (closed) for motivation. This MR is an extension of !4905 (closed); it replaces both wl_display_dispatch()
calls in backend/wayland/output.c
with calls to wl_display_dispatch_queue()
, that only process the events for the specific objects that are being waited for.
The wayland backend logic is modified so that, when waiting for an xdg_surface.configure
event, the call to wlr_output_send_request_state()
is delayed until after the wl_display_dispatch_queue()
loop ends: this ensures that it will only happen once, even if multiple configure
events are received.
Also, wlr_wl_output_create()
now blocks until the first configure is done.
Note: it is still possible to recursively invoke output_commit()
, because when the output is mapped after being unmapped, wlr_output_send_request_state()
gets called inside output_commit()
, and emits a signal whose listeners could call output_commit()
. I do not currently know of a good way to solve this, so I've left a TODO in the code. (I'm not marking this as a draft, because I think this MR is still a strict improvement.)
This involves parts of wlroots that I'm not very familiar with, so it's possible I've made a mistake somewhere.