xdg_shell: handle_commit() could receive new geometry of size outside of the toplevel set boundaries (#9130)#9133
Open
dawsers wants to merge 2 commits into
Open
Conversation
… of the toplevel set boundaries (swaywm#9130)
Author
|
Another option would be to add the check to wlroots, in uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_toplevel *toplevel,
int32_t width, int32_t height) {
assert(width >= 0 && height >= 0);
if ((toplevel->pending.min_width > 0 && width < toplevel->pending.min_width) ||
(toplevel->pending.min_height > 0 && height < toplevel->pending.min_height) ||
(toplevel->pending.max_width > 0 && width > toplevel->pending.max_width) ||
(toplevel->pending.max_height > 0 && height > toplevel->pending.max_height)) {
return 0;
}
toplevel->scheduled.width = width;
toplevel->scheduled.height = height;
return wlr_xdg_surface_schedule_configure(toplevel->base);
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I don't know if this PR can have unintended consequences, but it fixes #9130
I think this is a bug in Qt, because they set the minimum size and then commit a surface with smaller geometry than the minimum size, but using this workaround that I think should be valid in general, we can "fix" it.
The client was setting a minimum size for the toplevel, and then committing a geometry with a smaller size.
handle_commit()was seeing the new size and callingwlr_xdg_toplevel_set_size()that was sending a new configure with the smaller size. This was creating a loop where the client would alternate sending commits with the smaller and the bigger size, resulting in flickering of the window.