Fullscreen issue on Windows export

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AltoWaltz

Hello, I have an issue where taskbar gets active on the windows export when users click on the windows taskbar area while in fullscreen.

func Resolution():
	ProjectSettings.set_setting("display/window/size/width", res_width)
	ProjectSettings.set_setting("display/window/size/height", res_height)

	OS.set_window_size(Vector2(res_width, res_height))

if (fullscreen == true):
	OS.set_window_fullscreen(false)
	OS.set_window_fullscreen(true)
elif (fullscreen == false):
	OS.set_window_fullscreen(true)
	OS.set_window_fullscreen(false)
	OS.set_window_position(Vector2(0,0))

Settings:
Display/Resizable = On
Display/Borderless = Off
Display/Fullscreren = Off

This works pretty much how I want it to want on the Linux export. However, when I export to Windows the area of the windows taskbar gets active when clicking on it, effectively throwing the user out of the game.

I have tried with the code below but it looks like it doesn’t change anything:

var screenSize = Vector2(0,0)
screenSize.x = get_viewport().get_visible_rect().size.x # Get Width
screenSize.y = get_viewport().get_visible_rect().size.y # Get Height

ProjectSettings.set_setting("display/window/size/width", screenSize.x)
ProjectSettings.set_setting("display/window/size/height", screenSize.y)

OS.set_window_size(Vector2(screenSize.x, screenSize.y))

And help appreciated. Thank you.

:bust_in_silhouette: Reply From: MisterMano
  1. Instead of fullscreen == true, just use “if fullscreen:
  2. No need to make the second statement an elif. If fullscreen is true, the else means it’s false, no need to check.
  3. In both situations, you first set the screen to the opposite of what you want, then to the desired situation. Any reason for that?
  4. You could also do away with the if/else and simply use OS.window_fullscreen = fullscreen

Do try making the window borderless when making it fullscreen and see if the problem persists:

OS.window_fullscreen = fullscreen
OS.window_borderless = fullscreen

In this situation, fullscreen as true also gets rid of the border/taskbar. If false, it shows it again