From 8ee7b5dd33119f6a762b56735bdecce0ec165961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 3 Apr 2014 18:50:37 +0200 Subject: Add sdl_window:grab_input/2 --- c_src/sdl_window.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'c_src/sdl_window.c') diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c index 6cc37a8..bdd66a4 100644 --- a/c_src/sdl_window.c +++ b/c_src/sdl_window.c @@ -507,3 +507,22 @@ NIF_FUNCTION(set_window_fullscreen) return nif_thread_call(env, thread_set_window_fullscreen, 2, NIF_RES_GET(Window, window_res), flags); } + +// set_window_grab + +NIF_CAST_HANDLER(thread_set_window_grab) +{ + SDL_SetWindowGrab(args[0], (long)args[1]); +} + +NIF_FUNCTION(set_window_grab) +{ + void* window_res; + SDL_bool b; + + BADARG_IF(!enif_get_resource(env, argv[0], res_Window, &window_res)); + BADARG_IF(!atom_to_bool(env, argv[1], &b)); + + return nif_thread_cast(env, thread_set_window_grab, 2, + NIF_RES_GET(Window, window_res), b); +} -- cgit v1.2.3