Skip to content

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
swaywm:masterfrom
dawsers:commit-respect-boundaries
Open

xdg_shell: handle_commit() could receive new geometry of size outside of the toplevel set boundaries (#9130)#9133
dawsers wants to merge 2 commits into
swaywm:masterfrom
dawsers:commit-respect-boundaries

Conversation

@dawsers
Copy link
Copy Markdown

@dawsers dawsers commented Apr 27, 2026

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 calling wlr_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.

@dawsers
Copy link
Copy Markdown
Author

dawsers commented Apr 28, 2026

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), something like:

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Qt Applications: clicking a QPrintDialog's Options button causes the window to flicker in a loop of resizes

1 participant