1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fixed F4 (fullscreen hotkey) not actually changing window mode

This commit is contained in:
Ivan Savenko 2024-05-23 14:54:13 +00:00
parent 7a6540ec2f
commit 949c0cff70
2 changed files with 8 additions and 10 deletions

View File

@ -164,6 +164,7 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
{ {
if(ev.key.keysym.sym == SDLK_F4 && (ev.key.keysym.mod & KMOD_ALT)) if(ev.key.keysym.sym == SDLK_F4 && (ev.key.keysym.mod & KMOD_ALT))
{ {
// FIXME: dead code? Looks like intercepted by OS/SDL and delivered as SDL_Quit instead?
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex); boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
handleQuit(true); handleQuit(true);
return; return;
@ -175,16 +176,6 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
handleQuit(true); handleQuit(true);
return; return;
} }
if(ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_F4)
{
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
Settings full = settings.write["video"]["fullscreen"];
full->Bool() = !full->Bool();
GH.onScreenResize(false);
return;
}
} }
else if(ev.type == SDL_USEREVENT) else if(ev.type == SDL_USEREVENT)
{ {

View File

@ -78,6 +78,13 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
if (vstd::contains(shortcutsVector, EShortcut::MAIN_MENU_LOBBY)) if (vstd::contains(shortcutsVector, EShortcut::MAIN_MENU_LOBBY))
CSH->getGlobalLobby().activateInterface(); CSH->getGlobalLobby().activateInterface();
if (vstd::contains(shortcutsVector, EShortcut::GLOBAL_FULLSCREEN))
{
Settings full = settings.write["video"]["fullscreen"];
full->Bool() = !full->Bool();
GH.onScreenResize(true);
}
if (vstd::contains(shortcutsVector, EShortcut::SPECTATE_TRACK_HERO)) if (vstd::contains(shortcutsVector, EShortcut::SPECTATE_TRACK_HERO))
{ {
Settings s = settings.write["session"]; Settings s = settings.write["session"];