diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/sdl2helper.cpp | 5 | ||||
-rw-r--r-- | src/utils/sdl2helper.h | 1 | ||||
-rw-r--r-- | src/utils/sdlhelper.cpp | 5 | ||||
-rw-r--r-- | src/utils/sdlhelper.h | 1 |
4 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 1ae8b087f..442d40990 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -47,4 +47,9 @@ void SDL::SetWindowIcon(SDL_Window *const window, SDL_Surface *const icon) SDL_SetWindowIcon(window, icon); } +void SDL::grabInput(SDL_Window *const window, const bool grab) +{ + SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE); +} + #endif // USE_SDL2 diff --git a/src/utils/sdl2helper.h b/src/utils/sdl2helper.h index bf3c57f0c..956a63ff8 100644 --- a/src/utils/sdl2helper.h +++ b/src/utils/sdl2helper.h @@ -37,6 +37,7 @@ namespace SDL void SetWindowIcon(SDL_Window *const window, SDL_Surface *const icon); + void grabInput(SDL_Window *const window, const bool grab); } // namespace SDL #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp index 9d28f6c96..a470ce927 100644 --- a/src/utils/sdlhelper.cpp +++ b/src/utils/sdlhelper.cpp @@ -73,4 +73,9 @@ void SDL::SetWindowIcon(SDL_Surface *const window A_UNUSED, SDL_WM_SetIcon(icon, nullptr); } +void SDL::grabInput(SDL_Surface *const window A_UNUSED, const bool grab) +{ + SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF); +} + #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h index 9d122f934..912528a29 100644 --- a/src/utils/sdlhelper.h +++ b/src/utils/sdlhelper.h @@ -41,6 +41,7 @@ namespace SDL void SetWindowIcon(SDL_Surface *const window A_UNUSED, SDL_Surface *const icon); + void grabInput(SDL_Surface *const window A_UNUSED, const bool grab); } // namespace SDL #endif // USE_SDL2 |