diff options
| author | verdant <im@verdant.ee> | 2026-07-27 09:27:42 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-07-27 09:27:42 +0800 |
| commit | 165534e03463cc1a0072f46cb1228b41890978af (patch) | |
| tree | 04e1a9921b9a90e879523d2084edde4f77530c9b | |
| parent | 8cb4f73bca481eb08448289c86a8e3b7392414cf (diff) | |
| download | sf-165534e03463cc1a0072f46cb1228b41890978af.tar.gz sf-165534e03463cc1a0072f46cb1228b41890978af.zip | |
Add display structure improvements
| -rw-r--r-- | display.c | 13 | ||||
| -rw-r--r-- | display.h | 22 |
2 files changed, 30 insertions, 5 deletions
@@ -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(); } @@ -4,6 +4,7 @@ #include <ncurses.h> #include <stdlib.h> +#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 */ |
