mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Allow toggling fullscreen without restart and add keybind (#14714)
This commit is contained in:
@@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "settings.h"
|
||||
#include "util/numeric.h"
|
||||
#include "inputhandler.h"
|
||||
#include "gui/mainmenumanager.h"
|
||||
@@ -113,6 +114,19 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
|
||||
return true;
|
||||
}
|
||||
|
||||
// This is separate from other keyboard handling so that it also works in menus.
|
||||
if (event.EventType == EET_KEY_INPUT_EVENT) {
|
||||
const KeyPress keyCode(event.KeyInput);
|
||||
if (keyCode == getKeySetting("keymap_fullscreen")) {
|
||||
if (event.KeyInput.PressedDown && !fullscreen_is_down) {
|
||||
bool fullscreen = RenderingEngine::get_raw_device()->isFullscreen();
|
||||
g_settings->setBool("fullscreen", !fullscreen);
|
||||
}
|
||||
fullscreen_is_down = event.KeyInput.PressedDown;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Let the menu handle events, if one is active.
|
||||
if (isMenuActive()) {
|
||||
if (g_touchscreengui)
|
||||
|
Reference in New Issue
Block a user