This commit is contained in:
nova
2026-05-15 00:10:23 +02:00
parent 8c80a6e3da
commit c692a1a992

12
main.c
View File

@@ -21,7 +21,6 @@ unsigned int temp_width = 0;
unsigned int settings; unsigned int settings;
unsigned int file_modifiers = 0; unsigned int file_modifiers = 0;
unsigned int status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY) & ~STATUS_UPDATE_SCREEN_RESIZE; unsigned int status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY) & ~STATUS_UPDATE_SCREEN_RESIZE;
char *start_path;
char *global_path; char *global_path;
time_t seed; time_t seed;
@@ -38,7 +37,6 @@ extern pthread_mutex_t mutex_mid;
extern pthread_mutex_t mutex_rgt; extern pthread_mutex_t mutex_rgt;
char *input; /*used in user_interactions*/ char *input; /*used in user_interactions*/
char *terminal_width_empty_line; /* used in user_interactions */
void render_pass(); void render_pass();
void init(); void init();
@@ -65,7 +63,6 @@ int main(){
pthread_t thread_m; pthread_t thread_m;
pthread_t thread_r; pthread_t thread_r;
terminal_width_empty_line = malloc(terminal_width);
#if SETTINGS_RELOAD_DIR_DELTA != 0 #if SETTINGS_RELOAD_DIR_DELTA != 0
time_t t; time_t t;
time_t dt; time_t dt;
@@ -78,18 +75,12 @@ int main(){
pthread_create(&thread_r, NULL, thread_rgt, &status); /*child_content slash win_r*/ pthread_create(&thread_r, NULL, thread_rgt, &status); /*child_content slash win_r*/
pthread_create(&thread_b, NULL, thread_btm, &status); /*bottom bar*/ pthread_create(&thread_b, NULL, thread_btm, &status); /*bottom bar*/
/* running through all once manually in order to get an as fast as possible first render on the screen */
pthread_cond_signal(&cond_mid);
pthread_cond_signal(&cond_lft);
render_pass();
timeout(SETTINGS_CURSES_TIMEOUT); timeout(SETTINGS_CURSES_TIMEOUT);
while(!(status & STATUS_QUIT_PROGRAM)){ while(!(status & STATUS_QUIT_PROGRAM)){
getmaxyx(stdscr, terminal_height, terminal_width); getmaxyx(stdscr, terminal_height, terminal_width);
user_interactions();
if (status & STATUS_RUN_BACKEND) { if (status & STATUS_RUN_BACKEND) {
free(global_path); free(global_path);
global_path = getcwd(NULL, 0); global_path = getcwd(NULL, 0);
@@ -106,6 +97,7 @@ int main(){
temp_width = terminal_width; temp_width = terminal_width;
temp_heigth = terminal_height; temp_heigth = terminal_height;
} }
user_interactions();
render_pass(); render_pass();
#if SETTINGS_RELOAD_DIR_DELTA != 0 #if SETTINGS_RELOAD_DIR_DELTA != 0
@@ -121,7 +113,6 @@ int main(){
ueberzug_close(); ueberzug_close();
#endif #endif
threading_free(); threading_free();
free(start_path);
delwin(win_l); delwin(win_l);
delwin(win_m); delwin(win_m);
@@ -179,7 +170,6 @@ void init() {
/*file_modifiers = (FILE_MODIFIERS_HIDDEN_FILES | FILE_MODIFIERS_SORT_BITMASK);*/ /*file_modifiers = (FILE_MODIFIERS_HIDDEN_FILES | FILE_MODIFIERS_SORT_BITMASK);*/
input = malloc(INPUT_BUFFER_SIZE); /* size of input buffer, out of bounds access will not be accounted for */ input = malloc(INPUT_BUFFER_SIZE); /* size of input buffer, out of bounds access will not be accounted for */
memset(input, 0, INPUT_BUFFER_SIZE); memset(input, 0, INPUT_BUFFER_SIZE);
status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
if (getuid() == 0) { if (getuid() == 0) {
status |= STATUS_USER_ROOT; status |= STATUS_USER_ROOT;
} }