diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-24 13:33:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:17 +0300 |
commit | 2652836af364935294a2c731de74502de530f9e6 (patch) | |
tree | 97a19407af17f2ad19d830a41e35b41771a5df27 /src | |
parent | c63a2a04e47c361a7254b0749298de84a6f331fa (diff) | |
download | plus-2652836af364935294a2c731de74502de530f9e6.tar.gz plus-2652836af364935294a2c731de74502de530f9e6.tar.bz2 plus-2652836af364935294a2c731de74502de530f9e6.tar.xz plus-2652836af364935294a2c731de74502de530f9e6.zip |
fix "grab input" in SDL2.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 8 | ||||
-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 |
5 files changed, 14 insertions, 6 deletions
diff --git a/src/client.cpp b/src/client.cpp index 974e8d400..f7fd72094 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2815,12 +2815,8 @@ void Client::resizeVideo(int width, int height, const bool always) void Client::applyGrabMode() { -#ifdef USE_SDL2 - // +++ need use SDL_SetWindowGrab -#else - SDL_WM_GrabInput(config.getBoolValue("grabinput") - ? SDL_GRAB_ON : SDL_GRAB_OFF); -#endif + SDL::grabInput(mainGraphics->getWindow(), + config.getBoolValue("grabinput")); } void Client::applyGamma() 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 |