From 550bd493cdb4696069f23b00616b86daa348a89a Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sun, 26 Apr 2020 16:49:50 +0200 Subject: Greatly simplify view offset handling Fixes https://github.com/ifreund/river/issues/9 --- src/box.zig | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/box.zig') diff --git a/src/box.zig b/src/box.zig index 5d33f98..2d28a1c 100644 --- a/src/box.zig +++ b/src/box.zig @@ -1,6 +1,17 @@ -pub const Box = struct { - x: i32, - y: i32, - width: u32, - height: u32, -}; +const Self = @This(); + +const c = @import("c.zig"); + +x: i32, +y: i32, +width: u32, +height: u32, + +pub fn toWlrBox(self: Self) c.wlr_box { + return c.wlr_box{ + .x = @intCast(c_int, self.x), + .y = @intCast(c_int, self.y), + .width = @intCast(c_int, self.width), + .height = @intCast(c_int, self.height), + }; +} -- cgit v1.2.3