diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index e0db7556..da42e621 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -149,6 +149,13 @@ static bool configure(struct sway_view *view, uint32_t *serial, return false; } + // avoid same size configures as clients may not ack & commit them + struct wlr_xdg_toplevel *top = view->wlr_xdg_toplevel; + if ((int) top->pending.width == width && + (int) top->pending.height == height) { + return false; + } + *serial = wlr_xdg_toplevel_set_size(top, width, height); return true; } diff --git a/sway/tree/view.c b/sway/tree/view.c index 9213d34a..5770f685 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -1,6 +1,7 @@ #define _POSIX_C_SOURCE 200809L #include #include +#include #include #include #include @@ -166,6 +167,14 @@ void view_get_constraints(struct sway_view *view, double *min_width, bool view_configure(struct sway_view *view, uint32_t *serial, double lx, double ly, int width, int height) { + // Many clients don't play nicely if you try to reconfigure them out of + // their specified constraints. Clamp the values. + double minw, maxw, minh, maxh; + view_get_constraints(view, &minw, &maxw, &minh, &maxh); + + width = fmax(fmin(width, maxw), minw); + height = fmax(fmin(height, maxh), minh); + if (view->impl->configure) { return view->impl->configure(view, serial, lx, ly, width, height); }