From 0376bd733d59d8577ffbedb4463372633b6969e6 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sat, 15 Jul 2023 22:44:10 -0500 Subject: [PATCH] view: update wlr_toplevel size on client resizes If a floating client resizes itself, sway updates several of its internal dimensions to match but not wlr_toplevel. This means that the next time wlroots sends a toplevel configure event, it can have wrong coordinates that resize the client back to its old size. To fix this, let's just update the next scheduled width/height of the wlr_toplevel when the view size changes. Fixes #5266. --- sway/tree/view.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sway/tree/view.c b/sway/tree/view.c index ec54fed81d..5350ad648e 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -931,6 +931,14 @@ void view_update_size(struct sway_view *view) { con->pending.content_width = view->geometry.width; con->pending.content_height = view->geometry.height; container_set_geometry_from_content(con); + + // Update the next scheduled width/height so correct coordinates + // are sent on the next toplevel configure from wlroots. + struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_toplevel->base; + if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { + view->wlr_xdg_toplevel->scheduled.width = view->geometry.width; + view->wlr_xdg_toplevel->scheduled.height = view->geometry.height; + } } void view_center_surface(struct sway_view *view) {