~novakane/zelbar

6b770f4585f7bd5be6e4bfa45c795a2e695b7e21 — Hugo Machet 8 months ago 81ad346
data: Remove pointer arg in render()

This was not needed, remove the need for @ptrCast().
1 files changed, 5 insertions(+), 6 deletions(-)

M src/data.zig
M src/data.zig => src/data.zig +5 -6
@@ 61,9 61,9 @@ pub fn expose(input: []const u8, pix: *pixman.Image, bar_x: u16, bar_w: u16) !vo

        var e = entries.list.get(index);
        switch (e.alignment) {
            .left => entries_x[L] -= try e.render(pix, @ptrCast(*i16, &entries_x[L]), entry_h),
            .center => entries_x[C] -= try e.render(pix, @ptrCast(*i16, &entries_x[C]), entry_h),
            .right => entries_x[R] -= try e.render(pix, @ptrCast(*i16, &entries_x[R]), entry_h),
            .left => entries_x[L] -= try e.render(pix, entries_x[L], entry_h),
            .center => entries_x[C] -= try e.render(pix, entries_x[C], entry_h),
            .right => entries_x[R] -= try e.render(pix, entries_x[R], entry_h),
        }
    }



@@ 229,9 229,8 @@ const Entry = struct {
    ///   height: Usable entry height based on bar height.
    ///
    /// Return the total width of the entry to use as 'x' for the next one.
    pub fn render(entry: Entry, pix: *pixman.Image, prev_x: *i16, height: u16) !u16 {
        var x = prev_x.*;

    pub fn render(entry: Entry, pix: *pixman.Image, prev_x: u16, height: u16) !u16 {
        var x = @intCast(i16, prev_x);
        switch (entry.alignment) {
            .left, .center => x = x + entry.offset - @intCast(i16, entry.width) - entry.offset,
            .right => x = x - @intCast(i16, entry.width) - entry.offset,