mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix two problems with toggling fullscreen at runtime (#14750)
This commit is contained in:
parent
9def45aa80
commit
bc23a610d3
2 changed files with 12 additions and 3 deletions
|
@ -118,8 +118,14 @@ bool MyEventReceiver::OnEvent(const SEvent &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);
|
||||
IrrlichtDevice *device = RenderingEngine::get_raw_device();
|
||||
|
||||
bool new_fullscreen = !device->isFullscreen();
|
||||
// Only update the setting if toggling succeeds - it always fails
|
||||
// if Minetest was built without SDL.
|
||||
if (device->setFullscreen(new_fullscreen)) {
|
||||
g_settings->setBool("fullscreen", new_fullscreen);
|
||||
}
|
||||
}
|
||||
fullscreen_is_down = event.KeyInput.PressedDown;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue