toplevel-info: Fix race between binding wl_ouput
and output_enter
#668
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue with
cosmic-panel
where, when a workspace is moved back to an output after a monitor is disconnected and reconnected, the panel doesn't hide becausecosmic-panel
thinks no toplevel is open on that monitor.After some testing, it seems
output_enter
isn't being sent here. In particular, theoutput_leave
call happens before the client binds thewl_output
, so there is nowl_output
to send in an event yet.This is addressed by keeping track of a set of
wl_output
s that we have sent the event to. So if an output is bound,refresh
can add it to this list and send the event.This is not needed for workspaces (though it could be done similarly) since the handle objects are created by server events. So no race should occur as long as the workspaces global is bound before the toplevel info one.