wayland: Refactor toplevel mapping, implement HideWindow #4319
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 moves around the xdg_toplevel management in a way that allows us to implement HideWindow/ShowWindow properly.
For the most part this actually ended up being isolated from the rest of the driver; we have some early returns when the toplevel hasn't been made yet but it turns out it's more robust to just push all window state at ShowWindow time anyway. As a result this is really just changing the location and not really changing core functionality. The one exception is an extremely annoying behavior in the Wayland protocol where you have to manually detach any buffers from the wl_surface when creating the toplevel a second time, even though unmapping is supposed to be a full reset.
This was tested in both windowed/fullscreen mode on GNOME and Plasma and behavior was consistent.