How to: Multiwindow Fullscreen without 1px border?

Godot Version

v4.5.stable.steam [876b29033]

Question

Godot offers two fullscreen options: WINDOW_MODE_FULLSCREEN and WINDOW_MODE_EXCLUSIVE_FULLSCREEN. The Multiple Resolutions tutorial notes that games should use Exclusive Fullscreen, since Fullscreen leaves a 1px line of clear color at the bottom of the screen.

However, I personally find Exclusive Fullscreen annoying, due to the side effects of exclusive fullscreen mode – the window snipping tool sees the most recent non-exclusive frame, alt-tabbing is significantly slower, and overlays like the Game Bar or Discord’s that require running games in borderless fullscreen don’t function properly. Furthermore, Microsoft themselves document that the intended behavior for new applications should be to use a fullscreen borderless window with Full Screen Optimization – IIUC, the very thing the 1px line is intended to inhibit.

Is there a way to get multiwindow fullscreen mode without the extra 1px border? I’ll even go so far as to use a custom engine patch to implement the desired behavior, but even grepping around the godot codebase I’m not sure what I’d need to edit.

WindowFlag WINDOW_FLAG_BORDERLESS
And this function.

you will have to disable the embed game option in the Game mainscreen to see it when running the scene from the editor.

Ah, so instead of using window_set_mode to ask the engine to change window mode, manually take WINDOW_MODE_WINDOWED and set it to cover the full screen as a borderless window. Unfortunately, this doesn’t work. I wrote the following quick test script:

func _ready() -> void:
	var screen_size := DisplayServer.screen_get_size(DisplayServer.SCREEN_OF_MAIN_WINDOW)
	var screen_position := DisplayServer.screen_get_position(DisplayServer.SCREEN_OF_MAIN_WINDOW)
	DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
	DisplayServer.window_set_position(screen_position)
	DisplayServer.window_set_size(screen_size)

func _process(_delta: float) -> void:
	print(DisplayServer.window_get_mode())

This results in printing 4, which is WINDOW_MODE_EXCLUSIVE_FULLSCREEN. The engine is being “too smart” in this case, seeing that I’ve set the window to cover the full screen and changing to exclusive fullscreen mode, which is what I want to avoid.

Interestingly, though, Godot 4.5 seems to have changed how borderless fullscreen works: instead of the bottom line of pixels being left as the clear color, the window instead is extended by two pixels off the side of the screen. (I use a 2560x1440 monitor; the WINDOW_MODE_FULLSCREEN window is 2562x1440.) This isn’t optimal, since the window now peeks into a second monitor, but I think I can live with this compromise. (The point is to disable FSO for GUI applications. A game would actually want to receive FSO, but many games don’t get it anyway, since it can be finicky to fulfill the OS heuristics.)

1 Like

I think there is a note in the docs saying that in fullscreen mode the boardless option is ignored. So you would have to abandon the project setting of fullscreen, but then quarry the screen size and manually set the window size to fake a full screen.

Also if you intend to have multiple windows, the set_flag function takes a window index as parameter.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.