#include #include #include #include #include "defines.h" extern unsigned int file_modifiers; unsigned long selected_file_current; unsigned long selected_file_last; extern pthread_mutex_t mutex_selection; void user_interactions(char *input, unsigned int *status, unsigned int *settings) { if (*input == 'q') { *status ^= STATUS_QUIT_PROGRAM; } else if (*input == *"KEY_BACKSPACE") { file_modifiers ^= FILE_MODIFIERS_HIDDEN_FILES; } else if (*input == 'a') { file_modifiers ^= FILE_MODIFIERS_HIDDEN_FILES; *status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); } else if (*input == 'o') { file_modifiers ^= FILE_MODIFIERS_SORT_BITMASK; } else if (*input == 'e') { file_modifiers ^= FILE_MODIFIERS_SORT_ALPHABETIC; } else if (*input == 'u') { *status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); } else if (*input == 'h') { chdir(".."); *status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK); } else if (*input == 't') { 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); } else if (*input == 'n') { 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); } else { } }