mirror of
https://github.com/fairyglade/ly.git
synced 2026-03-21 22:43:38 +00:00
Remove resolution_changed bool
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
33
src/main.zig
33
src/main.zig
@@ -90,7 +90,6 @@ const UiState = struct {
|
|||||||
box: *CenteredBox,
|
box: *CenteredBox,
|
||||||
info_line: *InfoLine,
|
info_line: *InfoLine,
|
||||||
animate: bool,
|
animate: bool,
|
||||||
resolution_changed: bool,
|
|
||||||
session: *Session,
|
session: *Session,
|
||||||
login: *UserList,
|
login: *UserList,
|
||||||
password: *Text,
|
password: *Text,
|
||||||
@@ -734,7 +733,6 @@ pub fn main() !void {
|
|||||||
.box = &box,
|
.box = &box,
|
||||||
.info_line = &info_line,
|
.info_line = &info_line,
|
||||||
.animate = config.animation != .none,
|
.animate = config.animation != .none,
|
||||||
.resolution_changed = false,
|
|
||||||
.session = &session,
|
.session = &session,
|
||||||
.login = &login,
|
.login = &login,
|
||||||
.password = &password,
|
.password = &password,
|
||||||
@@ -856,23 +854,6 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (run) {
|
while (run) {
|
||||||
if (state.resolution_changed) {
|
|
||||||
state.buffer.width = TerminalBuffer.getWidthStatic();
|
|
||||||
state.buffer.height = TerminalBuffer.getHeightStatic();
|
|
||||||
|
|
||||||
try log_file.info("tui", "screen resolution updated to {d}x{d}", .{ state.buffer.width, state.buffer.height });
|
|
||||||
|
|
||||||
if (state.animation.*) |*a| a.realloc() catch |err| {
|
|
||||||
try info_line.addMessage(lang.err_alloc, config.error_bg, config.error_fg);
|
|
||||||
try log_file.err("tui", "failed to reallocate animation buffers: {s}", .{@errorName(err)});
|
|
||||||
};
|
|
||||||
|
|
||||||
positionComponents(&state);
|
|
||||||
|
|
||||||
state.update = true;
|
|
||||||
state.resolution_changed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.update) {
|
if (state.update) {
|
||||||
try updateComponents(&state);
|
try updateComponents(&state);
|
||||||
|
|
||||||
@@ -955,7 +936,19 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.type == termbox.TB_EVENT_RESIZE) {
|
if (event.type == termbox.TB_EVENT_RESIZE) {
|
||||||
state.resolution_changed = true;
|
state.buffer.width = TerminalBuffer.getWidthStatic();
|
||||||
|
state.buffer.height = TerminalBuffer.getHeightStatic();
|
||||||
|
|
||||||
|
try log_file.info("tui", "screen resolution updated to {d}x{d}", .{ state.buffer.width, state.buffer.height });
|
||||||
|
|
||||||
|
if (state.animation.*) |*a| a.realloc() catch |err| {
|
||||||
|
try info_line.addMessage(lang.err_alloc, config.error_bg, config.error_fg);
|
||||||
|
try log_file.err("tui", "failed to reallocate animation buffers: {s}", .{@errorName(err)});
|
||||||
|
};
|
||||||
|
|
||||||
|
positionComponents(&state);
|
||||||
|
|
||||||
|
state.update = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user