Godot Version
4.2.2 with C# support
Question
I’ve set up a 2d game with a key to change from windowed/maximazied to fullscreen. If the screen was in window mode before fullscreen when exiting it is going to be back to window mode. Same thing for maximized screen. The problem is that when i do maximized>fullscreen>maximize and then I press the button to go from maximized to windowed (yes, the default windows button) the window doesn’t go to window mode and instead the windows 7 gui appears. I’ve built the game also for linux and everything works just properly. The bug occurs both with exclusive fullscreen and with fullscreen. The following is the code used to switch window mode.
EDIT: Updating to godot 4.3 the bug seems to be gone, but now the code doesn’t seem to have any effect in Ubuntu 24.04.1 LTS
extends Node
var fullscreen
var settings: setting
var backToWindow = false
var character
# Called when the node enters the scene tree for the first time.
func _ready():
settings = setting.loadSettings()
fullscreen = settings.uFullscreen
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
else:
if DisplayServer.window_get_mode() == 4 and backToWindow == false:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MAXIMIZED)
else:
if DisplayServer.window_get_mode() == 4 and backToWindow:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
backToWindow == false
if (Input.is_action_just_pressed("fullscreen") and DisplayServer.window_get_mode() == 2):
fullscreen = true
backToWindow = false
else:
if (Input.is_action_just_pressed("fullscreen") and DisplayServer.window_get_mode() == 0):
fullscreen = true
backToWindow = true
else:
if DisplayServer.window_get_mode() == 4 and Input.is_action_just_pressed("fullscreen"):
fullscreen = false
if settings:
settings.uFullscreen = fullscreen
settings.save()