Skip to content

Commit

Permalink
view: update wlr_toplevel size on client resizes
Browse files Browse the repository at this point in the history
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 swaywm#5266.
  • Loading branch information
Dudemanguy committed Jul 20, 2023
1 parent c3e6390 commit 0376bd7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sway/tree/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0376bd7

Please sign in to comment.