mirror of
https://gittea.dev/nova/th.git
synced 2025-10-21 10:20:15 -04:00
imrovenments to rendering
This commit is contained in:
25
window.c
25
window.c
@@ -5,6 +5,8 @@
|
||||
#include "defines.h"
|
||||
#include "dir.h"
|
||||
|
||||
extern unsigned int terminal_height;
|
||||
extern unsigned int terminal_width;
|
||||
extern unsigned int status;
|
||||
extern char *input;
|
||||
|
||||
@@ -42,15 +44,13 @@ void window_top(WINDOW *win){
|
||||
wattroff(win, COLOR_PAIR(COLOR_PATH));
|
||||
pthread_mutex_unlock(&mutex_top);
|
||||
} else {
|
||||
wprintw(win,"loading");
|
||||
mvwaddstr(win, 0, terminal_width/2, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_0;
|
||||
}
|
||||
}
|
||||
void window_btm(WINDOW *win){
|
||||
werase(win);
|
||||
unsigned long local_width;
|
||||
unsigned long local_height;
|
||||
getmaxyx(win, local_height, local_width);
|
||||
|
||||
if (pthread_mutex_trylock(&mutex_btm) == 0) {
|
||||
if (*top_buffer != ' ') { /*printing ' ' (standard initialized value, see threading_init) makes valgrind throw a fuss*/
|
||||
mvwprintw(win, 0, 0, "%s", btm_buffer);
|
||||
@@ -59,31 +59,25 @@ void window_btm(WINDOW *win){
|
||||
/*the printing of the input char is done in user_interactions*/
|
||||
/*the printing of all possible inputs are done in user_interactions */
|
||||
} else {
|
||||
mvwprintw(win, local_height/2, local_width/2, "LOADING");
|
||||
mvwaddstr(win, 0, terminal_width/2, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_0;
|
||||
}
|
||||
}
|
||||
void window_lft(WINDOW *win){
|
||||
werase(win);
|
||||
|
||||
unsigned long local_width;
|
||||
unsigned long local_height;
|
||||
getmaxyx(win, local_height, local_width);
|
||||
if (pthread_mutex_trylock(&mutex_lft) == 0) {
|
||||
print_dir(win, 0, &lft_file_count, lft_content);
|
||||
pthread_mutex_unlock(&mutex_lft);
|
||||
|
||||
} else {
|
||||
mvwprintw(win, local_height/2, local_width/2, "LOADING");
|
||||
mvwaddstr(win, terminal_height/2, terminal_width/8, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_0;
|
||||
}
|
||||
}
|
||||
void window_mid(WINDOW *win){
|
||||
werase(win);
|
||||
|
||||
unsigned long local_width;
|
||||
unsigned long local_height;
|
||||
getmaxyx(win, local_height, local_width);
|
||||
if (pthread_mutex_trylock(&mutex_mid) == 0) {
|
||||
if (mid_file_count == 0) {
|
||||
mvwprintw(win, 0, 0, "empty");
|
||||
@@ -92,16 +86,13 @@ void window_mid(WINDOW *win){
|
||||
}
|
||||
pthread_mutex_unlock(&mutex_mid);
|
||||
} else {
|
||||
mvwprintw(win, local_height/2, local_width/2, "LOADING");
|
||||
mvwaddstr(win, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_0;
|
||||
}
|
||||
}
|
||||
void window_rgt(WINDOW *win){
|
||||
werase(win);
|
||||
|
||||
unsigned long local_width;
|
||||
unsigned long local_height;
|
||||
getmaxyx(win, local_height, local_width);
|
||||
if (pthread_mutex_trylock(&mutex_rgt) == 0) {
|
||||
if (rgt_file_count == 0) {
|
||||
if (rgt_content[0].file_type == FILE_TYPE_OPEN_FILE) {
|
||||
@@ -116,7 +107,7 @@ void window_rgt(WINDOW *win){
|
||||
}
|
||||
pthread_mutex_unlock(&mutex_rgt);
|
||||
} else {
|
||||
mvwprintw(win, local_height/2, local_width/2, "LOADING");
|
||||
mvwaddstr(win, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user