diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-09 22:54:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-09 22:56:17 +0300 |
commit | 481ea0b776bbab92b500540f59c5a191c6e93cba (patch) | |
tree | 5b73e15b5ab16d67095852d83ba764d83c36cbb8 /src/eventsmanager.cpp | |
parent | c108b00ddc98e99182bf1a0f83602772f4931122 (diff) | |
download | manaplus-481ea0b776bbab92b500540f59c5a191c6e93cba.tar.gz manaplus-481ea0b776bbab92b500540f59c5a191c6e93cba.tar.bz2 manaplus-481ea0b776bbab92b500540f59c5a191c6e93cba.tar.xz manaplus-481ea0b776bbab92b500540f59c5a191c6e93cba.zip |
Add workaround for fix alt-tab issue in SDL2.
Also add option to enable/disable this workaround.
Diffstat (limited to 'src/eventsmanager.cpp')
-rw-r--r-- | src/eventsmanager.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp index 76fe054fa..143937fe1 100644 --- a/src/eventsmanager.cpp +++ b/src/eventsmanager.cpp @@ -513,10 +513,16 @@ void EventsManager::handleSDL2WindowEvent(const SDL_Event &event) settings.mouseFocused = false; break; case SDL_WINDOWEVENT_FOCUS_GAINED: - settings.inputFocused = true; + settings.inputFocused = KeyboardFocus::Focused; break; +#if SDL_VERSION_ATLEAST(2, 0, 5) + case SDL_WINDOWEVENT_TAKE_FOCUS: + settings.inputFocused = KeyboardFocus::Focused2; + break; +#endif // SDL_VERSION_ATLEAST(2, 0, 5) + case SDL_WINDOWEVENT_FOCUS_LOST: - settings.inputFocused = false; + settings.inputFocused = KeyboardFocus::Unfocused; break; case SDL_WINDOWEVENT_MINIMIZED: WindowManager::setIsMinimized(true); @@ -624,7 +630,10 @@ void EventsManager::handleActive(const SDL_Event &event) #endif // DYECMD if ((event.active.state & SDL_APPINPUTFOCUS) != 0) - settings.inputFocused = (event.active.gain != 0u); + { + settings.inputFocused = (event.active.gain != 0u) ? + KeyboardFocus::Focused : KeyboardFocus::Unfocused; + } if ((event.active.state & SDL_APPMOUSEFOCUS) != 0) settings.mouseFocused = (event.active.gain != 0u); #ifndef DYECMD |