Remove use of deprecated aliases/types + use upstream zigini

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion 2025-03-16 22:45:46 +01:00
parent 13ba52319c
commit 9ded9fd765
No known key found for this signature in database
6 changed files with 17 additions and 17 deletions

View File

@ -9,7 +9,7 @@
.hash = "clap-0.10.0-oBajB434AQBDh-Ei3YtoKIRxZacVPF1iSwp3IX_ZB8f0",
},
.zigini = .{
.url = "https://github.com/AnErrupTion/zigini/archive/e61d31b2b7db3365993a20cc90e491d0cb0b7282.tar.gz",
.url = "https://github.com/Kawaii-Ash/zigini/archive/2ed3d417f17fab5b0ee8cad8a63c6d62d7ac1042.tar.gz",
.hash = "zigini-0.3.1-BSkB7XJGAAB2E-sKyzhTaQCBlYBL8yqzE4E_jmSY99sC",
},
},

View File

@ -303,7 +303,7 @@ pub fn main() !void {
// Load last saved username and desktop selection, if any
if (config.load) {
if (save.user) |user| {
try login.text.appendSlice(user);
try login.text.appendSlice(login.allocator, user);
login.end = user.len;
login.cursor = login.end;
active_input = .password;
@ -387,7 +387,7 @@ pub fn main() !void {
while (run) {
// If there's no input or there's an animation, a resolution change needs to be checked
if (!update or animate) {
if (!update) std.time.sleep(std.time.ns_per_ms * 100);
if (!update) std.Thread.sleep(std.time.ns_per_ms * 100);
_ = termbox.tb_present(); // Required to update tb_width() and tb_height()
@ -551,11 +551,11 @@ pub fn main() !void {
login.draw();
password.draw();
} else {
std.time.sleep(std.time.ns_per_ms * 10);
std.Thread.sleep(std.time.ns_per_ms * 10);
update = buffer.cascade();
if (!update) {
std.time.sleep(std.time.ns_per_s * 7);
std.Thread.sleep(std.time.ns_per_s * 7);
auth_fails = 0;
}
}

View File

@ -23,7 +23,7 @@ pub fn init(allocator: Allocator, buffer: *TerminalBuffer) InfoLine {
};
}
pub fn deinit(self: InfoLine) void {
pub fn deinit(self: *InfoLine) void {
self.label.deinit();
}

View File

@ -20,7 +20,7 @@ pub fn init(allocator: Allocator, buffer: *TerminalBuffer) Session {
};
}
pub fn deinit(self: Session) void {
pub fn deinit(self: *Session) void {
for (self.label.list.items) |*environment| {
if (environment.entry_ini) |*entry_ini| entry_ini.deinit();
if (environment.xdg_session_desktop) |session_desktop| self.label.allocator.free(session_desktop);

View File

@ -3,7 +3,7 @@ const interop = @import("../../interop.zig");
const TerminalBuffer = @import("../TerminalBuffer.zig");
const Allocator = std.mem.Allocator;
const DynamicString = std.ArrayList(u8);
const DynamicString = std.ArrayListUnmanaged(u8);
const termbox = interop.termbox;
@ -22,7 +22,7 @@ masked: bool,
maybe_mask: ?u32,
pub fn init(allocator: Allocator, buffer: *TerminalBuffer, masked: bool, maybe_mask: ?u32) Text {
const text = DynamicString.init(allocator);
const text: DynamicString = .empty;
return .{
.allocator = allocator,
@ -39,8 +39,8 @@ pub fn init(allocator: Allocator, buffer: *TerminalBuffer, masked: bool, maybe_m
};
}
pub fn deinit(self: Text) void {
self.text.deinit();
pub fn deinit(self: *Text) void {
self.text.deinit(self.allocator);
}
pub fn position(self: *Text, x: usize, y: usize, visible_length: usize) void {
@ -153,7 +153,7 @@ fn backspace(self: *Text) void {
fn write(self: *Text, char: u8) !void {
if (char == 0) return;
try self.text.insert(self.cursor, char);
try self.text.insert(self.allocator, self.cursor, char);
self.end += 1;
self.goRight();

View File

@ -5,7 +5,7 @@ const TerminalBuffer = @import("../TerminalBuffer.zig");
pub fn CyclableLabel(comptime ItemType: type) type {
return struct {
const Allocator = std.mem.Allocator;
const ItemList = std.ArrayList(ItemType);
const ItemList = std.ArrayListUnmanaged(ItemType);
const DrawItemFn = *const fn (*Self, ItemType, usize, usize) bool;
const termbox = interop.termbox;
@ -27,7 +27,7 @@ pub fn CyclableLabel(comptime ItemType: type) type {
return .{
.allocator = allocator,
.buffer = buffer,
.list = ItemList.init(allocator),
.list = .empty,
.current = 0,
.visible_length = 0,
.x = 0,
@ -38,8 +38,8 @@ pub fn CyclableLabel(comptime ItemType: type) type {
};
}
pub fn deinit(self: Self) void {
self.list.deinit();
pub fn deinit(self: *Self) void {
self.list.deinit(self.allocator);
}
pub fn position(self: *Self, x: usize, y: usize, visible_length: usize, text_in_center: ?bool) void {
@ -53,7 +53,7 @@ pub fn CyclableLabel(comptime ItemType: type) type {
}
pub fn addItem(self: *Self, item: ItemType) !void {
try self.list.append(item);
try self.list.append(self.allocator, item);
self.current = self.list.items.len - 1;
}