From 949c0cff70536f51df4835f7e10d3da8dfb55f5a Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 23 May 2024 14:54:13 +0000 Subject: [PATCH] Fixed F4 (fullscreen hotkey) not actually changing window mode --- client/eventsSDL/InputHandler.cpp | 11 +---------- client/eventsSDL/InputSourceKeyboard.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/client/eventsSDL/InputHandler.cpp b/client/eventsSDL/InputHandler.cpp index 9a91d8fde..194928c29 100644 --- a/client/eventsSDL/InputHandler.cpp +++ b/client/eventsSDL/InputHandler.cpp @@ -164,6 +164,7 @@ void InputHandler::preprocessEvent(const SDL_Event & ev) { 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); handleQuit(true); return; @@ -175,16 +176,6 @@ void InputHandler::preprocessEvent(const SDL_Event & ev) handleQuit(true); 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) { diff --git a/client/eventsSDL/InputSourceKeyboard.cpp b/client/eventsSDL/InputSourceKeyboard.cpp index 0baa0557a..ee43e5c53 100644 --- a/client/eventsSDL/InputSourceKeyboard.cpp +++ b/client/eventsSDL/InputSourceKeyboard.cpp @@ -78,6 +78,13 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key) if (vstd::contains(shortcutsVector, EShortcut::MAIN_MENU_LOBBY)) 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)) { Settings s = settings.write["session"];