Window method does not return correct value

Godot Version



I’m using nodes of the Window type
The method window.get_position_with_decorations() returns exactly the same value as window.position
The same problem happens with window.get_size_with_decorations() returning the same value as window.size
Am I supposed to configure the border of the window myself? I’m using the defaults right now, standard dark grey borders. I’m not seeing any options to configure border widths and whatnot so I’m assuming it’s just a bug.

on my machine get_window().size and get_window().get_size_with_decorations() return different results.


extends Node2D

func _ready() -> void:
	print("size ", get_window().size)
	print("get_position_with_decorations ", get_window().get_size_with_decorations())

program output:

Godot Engine v4.2.1.stable.mono.official.b09f793f5 -
Vulkan API 1.3.215 - Forward+ - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 630
size (1152, 648)
get_position_with_decorations (1168, 687)

You’re using a Node2D node, I’m talking about a Window node.

Here’s my code

extends Window
func _ready():
	print("window size ", size)
	print("window get_size_with_decorations ", get_size_with_decorations())
	print("window position ", position)
	print("window get_position_with_decorations ", get_position_with_decorations())

and here’s my output:

Godot Engine v4.2.1.stable.official.b09f793f5 -
Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #2: NVIDIA - NVIDIA GeForce 930M

window size (100, 100)
window get_size_with_decorations (100, 100)
window position (0, 0)
window get_position_with_decorations (0, 0)

I ran the same code in the root node (a Node2D) and I got the same correct result that you did, but this is where the issue is.

Are you using embedded windows (display/window/subwindows/embed_subwindows project setting, enabled by default)?

get_position_with_decorations and get_size_with_decorations are implemented only for the visible native windows (when OS window decorations are present).

I am using embedded windows. Is there a reason they’re not implemented? It seems to me like a pretty reasonable thing to do.