From 165534e03463cc1a0072f46cb1228b41890978af Mon Sep 17 00:00:00 2001 From: verdant Date: Mon, 27 Jul 2026 09:27:42 +0800 Subject: Add display structure improvements --- display.c | 13 +++++++++++-- display.h | 22 +++++++++++++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/display.c b/display.c index 8bde021..4f485ea 100644 --- a/display.c +++ b/display.c @@ -9,7 +9,7 @@ #include "version.h" #include "wm.h" -void color_pair_init() +void color_pair_init(void) { init_pair(COLOR_PAIR_STATUS_BAR, COLOR_BLACK, COLOR_WHITE); init_pair(COLOR_PAIR_PROGRESS, COLOR_YELLOW, COLOR_BLUE); @@ -19,11 +19,12 @@ void color_pair_init() init_pair(COLOR_PAIR_BORDER, COLOR_WHITE, COLOR_BLUE); } -terminal *ncurses_init() +terminal *ncurses_init(void) { initscr(); raw(); curs_set(0); + noecho(); if (!has_colors()) { log_write(LOG_WARN, "Terminal does not support colors"); } @@ -59,3 +60,11 @@ void wprintw_colorful(WINDOW *w, int attr, const char *format, ...) wattroff(w, COLOR_PAIR(attr)); va_end(ap); } + +void handle_resize(void) +{ + endwin(); + refresh(); +} + +void redraw(void) { erase(); } diff --git a/display.h b/display.h index 56c28f4..37f900a 100644 --- a/display.h +++ b/display.h @@ -4,6 +4,7 @@ #include #include +#include "dir.h" #include "log.h" #include "mem.h" @@ -18,10 +19,24 @@ #define BAR_LABEL_WIDTH 7 #define STAT_BAR_HEIGHT 1 +#define FM_PANE_LEFT 0 +#define FM_PANE_RIGHT 1 + #include "wm.h" -void color_pair_init(); -terminal *ncurses_init(); +typedef struct { + size_t top; + size_t bottom; + size_t height; + size_t widght; + size_t margin; + bool need_redraw; + window *left; + window *right; +} view_stat; + +void color_pair_init(void); +terminal *ncurses_init(void); static inline WINDOW *get_root_win(const terminal *t) { @@ -39,7 +54,8 @@ static inline WINDOW *get_root_win(const terminal *t) #define ROOT_WIN get_root_win(t) void draw_stat_bar(terminal *t, const char *sys_version); - void wprintw_colorful(WINDOW *w, int attr, const char *format, ...); +void handle_resize(void); +void redraw(void); #endif /* SF_DISPLAY_H */ -- cgit v1.2.3