fix leak by removing mlx_mouse_hide() :(

This commit is contained in:
mcolonna 2024-11-07 18:39:42 +01:00
parent f77a4446b6
commit f22e02bfc1

View file

@ -6,7 +6,7 @@
/* By: mc <mc@student.42.fr> +#+ +:+ +#+ */ /* By: mc <mc@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 14:43:36 by mcolonna #+# #+# */ /* Created: 2024/10/17 14:43:36 by mcolonna #+# #+# */
/* Updated: 2024/11/07 18:03:00 by mc ### ########.fr */ /* Updated: 2024/11/07 18:37:52 by mc ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -64,12 +64,13 @@ static int hook_mousemove(int x, int y)
return (0); return (0);
} }
// TODO hide cursor without leak?
void input_init(void *mlx_ptr, void *win_ptr) void input_init(void *mlx_ptr, void *win_ptr)
{ {
(void)mlx_ptr;
ft_memset(&g_input_actions, 0, sizeof(g_input_actions)); ft_memset(&g_input_actions, 0, sizeof(g_input_actions));
mlx_hook(win_ptr, DestroyNotify, StructureNotifyMask, set_quit, NULL); mlx_hook(win_ptr, DestroyNotify, StructureNotifyMask, set_quit, NULL);
mlx_hook(win_ptr, KeyPress, KeyPressMask, hook_keypress, NULL); mlx_hook(win_ptr, KeyPress, KeyPressMask, hook_keypress, NULL);
mlx_hook(win_ptr, KeyRelease, KeyReleaseMask, hook_keyrelease, NULL); mlx_hook(win_ptr, KeyRelease, KeyReleaseMask, hook_keyrelease, NULL);
mlx_hook(win_ptr, MotionNotify, PointerMotionMask, hook_mousemove, NULL); mlx_hook(win_ptr, MotionNotify, PointerMotionMask, hook_mousemove, NULL);
mlx_mouse_hide(mlx_ptr, win_ptr);
} }