Is there some mismatch between Godot window size pixels and OS X window size?

Godot Version



So I have my viewport setup in project settings as 1152x648, and I even have the window size overrides as 1152x648.

In my script, I have:

func _ready():
	var window := get_window()
	print("window.size=", window.size)

and on startup, I see window.size=(1152,648) in the console.

BUT my window is tiny, and measures 688x464 pixels (that probably includes some window borders or something, it’s based on taking a grab of the window to measure its size).

So in OS X, window pixels don’t seem to relate to actual window size?

Does this happen in Linux or Windows, or is it a Mac specific issue, or am I just missing something here?

Are you using a multi-monitor setup? Which scale factor are you using in the macOS display settings? Using scaling will affect the physical size of the window, as Godot currently doesn’t adjust it automatically (unless using fullscreen).

Godot enables hiDPI awareness so that it supports Retina displays. This means it renders at the display’s native resolution, as opposed to its scaled resolution. This also means the window size may appear to be too small by default until resized. See also Add automatic hiDPI UI scaling project setting · Issue #7968 · godotengine/godot-proposals · GitHub.

Yes, I’m running the laptop screen and a thunderbolt display.

My take-away is I should not worry about this issue at this time; I’ll play around with running full screen and worry about non-full-screen when I’m past prototype stage.

I was also a little confused by this at first being used to working with macOS retina scaling where the windows/controls are sized in some nominal pixel units and the upscaling to higher resolution (and more pixels) is under the hood when rendering to the screen. As this makes more sense to me I’ve set up a little script to emulate this behavior on my windows in godot that you might be able to use as well:

Basically you can use

retina_scale = DisplayServer.screen_get_scale(screen)

to get the screen resolution scale, and then then scale both the window size and and set the content scale using that:

if (window.content_scale_factor != retina_scale):
	#we need to change, calculate the relative change in scale
	var relative_scale:float = retina_scale / window.content_scale_factor
	#apply the change, as well as resizing window based on previous scale and relative scale
	window.content_scale_factor = retina_scale
	window.size = window.size*relative_scale

It works quite well, and I’ve even set it up using the node_added signal on the main tree to catch and correctly scale up popup windows like tooltips as they’re added.

Note however that DisplayServer.screen_get_scale(screen) is currently just implemented for macOS (see Implement `DisplayServer.screen_get_scale()` on Windows, Linux and Android · Issue #2661 · godotengine/godot-proposals · GitHub) so I have a fallback where I make a simple guess if it’s a highDPI monitor based on DisplayServer.screen_get_dpi(screen) that is implemented on other platforms.


Same problem here, suspected retina since it renders in exactly one half of specified resolution.

For now went to Project Settings / Display / Window, turned on “Advanced Settings” there, then under DPI turned off hiDPI. Seems to work fine.

No idea what will be the repercussions down the road, though.

Any news on this subject? Deactivating hiDPI doesn’t work for me. It’s quite frustrating to see the viewport representation in the editor at one size and running the game only shows half of that…

You can use the workaround listed in Is there some mismatch between Godot window size pixels and OS X window size? - #4 by lostminds for now, or set the window mode to fullscreen or exclusive fullscreen so that the window size is automatically set.