diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-26 16:49:50 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-26 16:49:50 +0200 |
| commit | 550bd493cdb4696069f23b00616b86daa348a89a (patch) | |
| tree | 82cc411690443ee0f1b061d48cb0195e5ec233e9 /src/box.zig | |
| parent | 21c3969c5fe23e3defefe89942c27d553af2bce7 (diff) | |
| download | river-550bd493cdb4696069f23b00616b86daa348a89a.tar.gz river-550bd493cdb4696069f23b00616b86daa348a89a.tar.xz | |
Greatly simplify view offset handling
Fixes https://github.com/ifreund/river/issues/9
Diffstat (limited to 'src/box.zig')
| -rw-r--r-- | src/box.zig | 23 |
1 files changed, 17 insertions, 6 deletions
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), + }; +} |
