/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_key_events.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:28:55 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:28:55 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include static void ft_insert_key(uint16_t keycode, t_cub *clist) { uint8_t i; i = 0; while (i < 5 && clist->key_input[i] != keycode && clist->key_input[i] != -1) i++; clist->key_input[i] = keycode; } int ft_key_event(int keycode, t_cub *clist) { const int32_t tmp_code = keycode; keycode = ft_convert_keycode(tmp_code); if (keycode == FT_ESC_KEY) return (ft_exit(0, (clist))); else if (keycode == FT_F1_KEY || keycode == FT_TAB_KEY) return (ft_f1_key(clist)); ft_insert_key(keycode, clist); return (0); }