#include #include #include #include #include "defines.h" #include "config.h" extern unsigned int file_modifiers; unsigned long selected_file_current; unsigned long selected_file_last; extern pthread_mutex_t mutex_selection; extern file *mid_content; extern file *lft_content; extern file *rgt_content; extern unsigned int status; void quit_program(){ status = STATUS_QUIT_PROGRAM; } void move_down(){ pthread_mutex_lock(&mutex_selection); /*capping the maximum file is done inside thread_mid */ selected_file_current++; status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); pthread_mutex_unlock(&mutex_selection); } void move_up(){ pthread_mutex_lock(&mutex_selection); if (selected_file_current != 0) { selected_file_current--; } status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); pthread_mutex_unlock(&mutex_selection); } void move_right(){ chdir(".."); status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY); } void move_left(){ chdir(mid_content[selected_file_current].file_name); status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY); } void toggle_hidden_files(){ file_modifiers ^= FILE_MODIFIERS_HIDDEN_FILES; status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY); } void jump_bottom(){ pthread_mutex_lock(&mutex_selection); selected_file_current = 0 - 1; status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); pthread_mutex_unlock(&mutex_selection); } void jump_top(){ pthread_mutex_lock(&mutex_selection); selected_file_current = 0; status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); pthread_mutex_unlock(&mutex_selection); } void user_interactions(char *input) { void (*func_ptr)(); unsigned long i = 0; for (i = 0; i < binding_count; i++) { if (*input == key_binding[i].key) { func_ptr = key_binding[i].func; func_ptr(); } } }