int ft_key_hook(int key_code, t_data *e) { t_files *ptr; void *fun_ptr; ptr = e->file; fun_ptr = menu_hook; if (e->pos == 1) { ptr = e->quality; fun_ptr = quality_hook; } while (ptr) { if (ptr->selected == TRUE) break ; ptr = ptr->next; } if (arrow_keys(key_code, e, ptr, fun_ptr) == TRUE) return (0); else if (key_code == ENTER) enter_key(e, ptr); else if (key_code == ESC) exit(0); return (0); }
void my_boucle(struct termios *t, t_list *list_final, t_node *node) { char buf[126]; int size; int i; i = 0; while ((size = read(0, buf, 3)) != 0) { signal(SIGWINCH, &get_winsize); if (buf[0] == 27 && buf[1] == 91 && buf[2] == 66 \ && node->next && size == 3) node = down_key(node, &i); else if (buf[0] == 27 && buf[1] == 91 && buf[2] == 65 \ && node->prev && size == 3) node = up_key(node, &i); else if (buf[0] == 32 && size == 1) space_key(list_final, node); else if (buf[0] == 10 && size == 1) enter_key(t, list_final); else if (buf[0] == 27 && size == 1) echap_key(t); aff_screen(node, i); } }