aboutsummaryrefslogtreecommitdiffstats
path: root/minilibx-linux/mlx_mouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'minilibx-linux/mlx_mouse.c')
-rw-r--r--minilibx-linux/mlx_mouse.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/minilibx-linux/mlx_mouse.c b/minilibx-linux/mlx_mouse.c
new file mode 100644
index 0000000..0ada4e4
--- /dev/null
+++ b/minilibx-linux/mlx_mouse.c
@@ -0,0 +1,26 @@
+#include "mlx_int.h"
+
+int mlx_mouse_move(t_xvar *xvar, t_win_list *win, int x, int y)
+{
+ XWarpPointer(xvar->display, None, win->window, 0, 0, 0, 0, x, y);
+ return (0);
+}
+
+int mlx_mouse_hide(t_xvar *xvar, t_win_list *win)
+{
+ static char data[1] = {0};
+ Cursor cursor;
+ Pixmap blank;
+ XColor dummy;
+
+ blank = XCreateBitmapFromData(xvar->display, win->window, data, 1, 1);
+ cursor = XCreatePixmapCursor(xvar->display, blank, blank, &dummy, &dummy, 0, 0);
+ XDefineCursor(xvar->display, win->window, cursor);
+ XFreePixmap(xvar->display, blank);
+ XFreeCursor(xvar->display, cursor);
+}
+
+int mlx_mouse_show(t_xvar *xvar, t_win_list *win)
+{
+ XUndefineCursor(xvar->display, win->window);
+}