godotengine / godotengine/godot

Repeated toggle fullscreen increases window size by the window decorations size each time we leave fullscreen

Open
#90,537 2 comments 0 reactions 0 assignees View on GitHub
bug topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in v4.2.1.stable.official [b09f793f5]

### 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` with `DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN` (or `WINDOW_MODE_FULLSCREEN`) and `DisplayServer.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](https://github.com/godotengine/godot/assets/1067772/d36f191e-c1ef-4430-b223-eac4ba8b7e89)

### Steps to reproduce

1. Open MRP > demo scene
2. Run the game
3. Press F or F11 to toggle fullscreen multiple times
4. Check Output log each time you leave fullscreen and observe delta in window size, equal to window decorations size
5. If you do it enough you will see the window get bigger with bare eyes too

### Minimal reproduction project (MRP)

[v4.2.1 - Toggle full screen repeated causes window height to accumulate extra.zip](https://github.com/godotengine/godot/files/14948771/v4.2.1.-.Toggle.full.screen.repeated.causes.window.height.to.accumulate.extra.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached minimal reproduction project and the DisplayServer.window_set_mode calls that alternate between fullscreen and windowed modes. Compare window_get_size_with_decorations() with window_get_size() after repeated toggles on Linux/X11; done means the window size no longer accumulates the decoration size when leaving fullscreen.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.