refactoring via defines.h
This commit is contained in:
15
main.c
15
main.c
@ -4,12 +4,13 @@
|
||||
#include <stdlib.h>
|
||||
#include "window.h"
|
||||
#include "interactions.h"
|
||||
#include "defines.h"
|
||||
|
||||
unsigned int terminal_height;
|
||||
unsigned int terminal_width;
|
||||
unsigned int temp_heigth = 0; //used for screen refresh
|
||||
unsigned int temp_width = 0;
|
||||
unsigned int settings = 1;
|
||||
unsigned int settings ;
|
||||
unsigned int status; //bit 0 = enable
|
||||
char **content_l; //content of parent dir, used in left window
|
||||
char **content_m; //content of current dir, used in main window
|
||||
@ -26,18 +27,18 @@ int main() {
|
||||
WINDOW *winl = newwin(terminal_height, terminal_width/3, terminal_height, (terminal_width/3));
|
||||
WINDOW *winm = newwin(terminal_height, terminal_width/3, 0, 0);
|
||||
WINDOW *winr = newwin(terminal_height, terminal_width/3, terminal_height, ((terminal_width/3)*2));
|
||||
settings ^= 1; //bit 0 = show_hidden_files
|
||||
status ^= 2; //update ui bit
|
||||
settings ^= SETTINGS_HIDDEN_FILES;
|
||||
status ^= STATUS_RUN_BACKEND;
|
||||
char input = 0;
|
||||
|
||||
content_l = calloc(1, sizeof(*content_l)); //allocation in order to allow a more streamlined backend
|
||||
content_m = calloc(1, sizeof(*content_m));
|
||||
content_r = calloc(1, sizeof(*content_r));
|
||||
|
||||
while(!(status & 1)){
|
||||
while(!(status & STATUS_QUIT_PROGRAM)){
|
||||
getmaxyx(stdscr, temp_heigth, temp_width);
|
||||
|
||||
if (status & 2) {
|
||||
if (status & STATUS_RUN_BACKEND) {
|
||||
pthread_t populate_l;
|
||||
pthread_t populate_m;
|
||||
pthread_t populate_r;
|
||||
@ -55,13 +56,13 @@ int main() {
|
||||
getmaxyx(stdscr, terminal_height, terminal_width);
|
||||
temp_heigth -= terminal_height;
|
||||
temp_width -= terminal_width;
|
||||
if (!temp_heigth || !temp_width || (status & 2)) { //updates screen
|
||||
if (!temp_heigth || !temp_width || (status & STATUS_RUN_BACKEND)) { //updates screen
|
||||
window_left(winl, 0, 0, content_l);
|
||||
window_main(winm, 0, terminal_width/3, content_m);
|
||||
window_right(winr, 0, (terminal_width/3)*2, content_r);
|
||||
wmove(stdscr,0,0);
|
||||
|
||||
status ^= 2;
|
||||
status ^= STATUS_RUN_BACKEND;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user