Open hsandt opened 7 months ago
My current workaround is to store the previous window size (before going fullscreen) and restore it manually after leaving fullscreen:
if new_window_mode == DisplayServer.WINDOW_MODE_WINDOWED:
DisplayServer.window_set_size(previous_window_size)
You still see a short glitch as the window fixes itself, but after that the window size is the expected one.
I tested the equivalent Window
method just to be sure (as it turned out to fix the issue on another Window issue https://github.com/godotengine/godot/issues/89543), but it didn't help.
var window := get_window()
# alternate this via action input
window.mode = Window.MODE_EXCLUSIVE_FULLSCREEN
window.mode = Window.MODE_WINDOWED
The issue still occurs when doing this instead of using DisplayServer.
Tested versions
System information
Godot v4.2.1.stable - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 860M (nvidia; 535.161.07) - Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz (8 Threads)
Issue description
Repeating toggle fullscreen (
DisplayServer.window_set_mode
withDisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN
(orWINDOW_MODE_FULLSCREEN
) andDisplayServer.WINDOW_MODE_WINDOWED
alternatively) increases the window size each time you leave fullscreen.This was very visible in my game as I'm using aspect
keep
, so black edges were immediately visible.I tried again in a MWE and found out that the exact size delta is equal to the window decorations size (obtained by computing ` DisplayServer.window_get_size_with_decorations() - DisplayServer.window_get_size()).
Test on Linux Ubuntu 22.04 with Unity desktop, where the decorations are just the window titlebar.
2024-04-11 Godot 4.2.1 repeated toggle fullscreen increase window size.webm
Steps to reproduce
Minimal reproduction project (MRP)
v4.2.1 - Toggle full screen repeated causes window height to accumulate extra.zip