diff options
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/esdl2.h | 1 | ||||
-rw-r--r-- | c_src/sdl_window.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/c_src/esdl2.h b/c_src/esdl2.h index 17c3565..1798815 100644 --- a/c_src/esdl2.h +++ b/c_src/esdl2.h @@ -164,6 +164,7 @@ F(get_window_brightness, 1) \ F(get_window_display_index, 1) \ F(get_window_flags, 1) \ + F(get_window_grab, 1) \ // Generated declarations for the NIF. diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c index a899656..818fa2f 100644 --- a/c_src/sdl_window.c +++ b/c_src/sdl_window.c @@ -169,3 +169,23 @@ NIF_FUNCTION(get_window_flags) return nif_thread_call(env, thread_get_window_flags, 1, NIF_RES_GET(Window, window_res)); } + +// get_window_grab + +NIF_CALL_HANDLER(thread_get_window_grab) +{ + if (SDL_GetWindowGrab(args[0])) + return atom_true; + + return atom_false; +} + +NIF_FUNCTION(get_window_grab) +{ + void* window_res; + + BADARG_IF(!enif_get_resource(env, argv[0], res_Window, &window_res)); + + return nif_thread_call(env, thread_get_window_grab, 1, + NIF_RES_GET(Window, window_res)); +} |