From 792d94253c191e653e4025a648d574d9f8ce99bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A4in=C3=B6=20M=C3=A4kel=C3=A4?= Date: Mon, 8 May 2023 20:36:21 +0300 Subject: [PATCH] XdgToplevel: keep wlroots updated on view sizes When sending a configure, wlroots will send the same size that was sent on the previous configure unless a new size is set. If a client resizes their window itself, the size wlroots has in XdgToplevel.scheduled will be obsolete and needs to be updated by river. --- river/XdgToplevel.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index bcb7bb6..0b5296c 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -139,6 +139,11 @@ pub fn configure(self: *Self) bool { _ = self.xdg_toplevel.setResizing(inflight.resizing); + // We need to call this wlroots function even if the inflight dimensions + // match the current dimensions in order to prevent wlroots internal state + // from getting out of sync in the case where a client has resized itself. + const configure_serial = self.xdg_toplevel.setSize(inflight.box.width, inflight.box.height); + // Only track configures with the transaction system if they affect the dimensions of the view. if (inflight.box.width == current.box.width and inflight.box.height == current.box.height) @@ -147,7 +152,7 @@ pub fn configure(self: *Self) bool { } self.configure_state = .{ - .inflight = self.xdg_toplevel.setSize(inflight.box.width, inflight.box.height), + .inflight = configure_serial, }; return true;