aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-02-14 16:55:24 +0100
committerIsaac Freund <ifreund@ifreund.xyz>2021-02-14 16:55:24 +0100
commitfb7d50a019a8fccb0576189ff60e80436e760aa3 (patch)
tree15016092af5c962db078eafe6734c9edf5ba2918
parent945b7dc9861f6c90d79d1faf5c97adc1da684253 (diff)
downloadriver-fb7d50a019a8fccb0576189ff60e80436e760aa3.tar.gz
river-fb7d50a019a8fccb0576189ff60e80436e760aa3.tar.xz
xdg shell: use XdgSurface.getGeometry()
This is important to use instead of direct access as clients are not strictly required to set a geometry, in which caese the dimensions of the wl_surface are used instead.
-rw-r--r--river/XdgToplevel.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig
index f80e480..fa20f08 100644
--- a/river/XdgToplevel.zig
+++ b/river/XdgToplevel.zig
@@ -171,10 +171,12 @@ fn handleMap(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wlr.XdgSurfa
view.surface = self.xdg_surface.surface;
- // Use the view's "natural" size centered on the output as the default
+ // Use the view's initial size centered on the output as the default
// floating dimensions
- view.float_box.width = @intCast(u32, self.xdg_surface.geometry.width);
- view.float_box.height = @intCast(u32, self.xdg_surface.geometry.height);
+ var initial_box: wlr.Box = undefined;
+ self.xdg_surface.getGeometry(&initial_box);
+ view.float_box.width = @intCast(u32, initial_box.width);
+ view.float_box.height = @intCast(u32, initial_box.height);
view.float_box.x = std.math.max(0, @divTrunc(@intCast(i32, view.output.usable_box.width) -
@intCast(i32, view.float_box.width), 2));
view.float_box.y = std.math.max(0, @divTrunc(@intCast(i32, view.output.usable_box.height) -