summaryrefslogtreecommitdiff
path: root/src/eventsmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-09 22:54:01 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-09 22:56:17 +0300
commit481ea0b776bbab92b500540f59c5a191c6e93cba (patch)
tree5b73e15b5ab16d67095852d83ba764d83c36cbb8 /src/eventsmanager.cpp
parentc108b00ddc98e99182bf1a0f83602772f4931122 (diff)
downloadmv-481ea0b776bbab92b500540f59c5a191c6e93cba.tar.gz
mv-481ea0b776bbab92b500540f59c5a191c6e93cba.tar.bz2
mv-481ea0b776bbab92b500540f59c5a191c6e93cba.tar.xz
mv-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.cpp15
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