Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewport width & height are incorrect on Windows when Resizable is disabled (DisplayServer regression) #62869

Open
Granpappy opened this issue Jul 10, 2022 · 4 comments

Comments

@Granpappy
Copy link

Godot version

4.0 alpha 11

System information

Windows 10

Issue description

Setting the viewport width and depth results in the true viewport size being +12 pixels for both width and height.
Tried setting the viewport via Project Settings -> General -> Display -> Window and noticed when I'd run my project, the viewport was showing things that shouldn't be visible. Printed the viewport size (get_viewport().get_visible_rect()) and confirmed that the sizing was off by +12 for both width & height. Putting width and height dimensions in that are 12 less than what I actually want gives correct viewport visuals.
Can't find any project setting that addresses why it would add twelve to both width & height, so I'm assuming this is an error. Checked on Godot 3 and it works as intended.

(NOTE : This only happens when the stretch mode is set to disabled)

Steps to reproduce

Set the viewport width and height via Project Settings -> General -> Display -> Window
Make a simple scene with a Node and attach a script with print_debug(get_viewport().get_visible_rect()) in _ready()
Run the scene and the output will show that the width & height are both off by +12 from what was put under the settings

Minimal reproduction project

No response

@Calinou Calinou added this to the 4.0 milestone Jul 10, 2022
@Calinou Calinou changed the title Viewport width & height both off by +12 pixels Viewport width & height both off by +12 pixels (DisplayServer regression) Jul 10, 2022
@JohannHiro
Copy link

JohannHiro commented Aug 8, 2022

I have the same issue in Godot alpha 13 with Windows 11
My width and height are both off by +10
However, I solve it by toggle the resizable option back to "on"

@Calinou
Copy link
Member

Calinou commented Aug 8, 2022

@Granpappy Can you reproduce this when Resizable is enabled in the Project Settings (which is the default)?

@Granpappy
Copy link
Author

No, I can't. Would that mean it's something I'm doing wrong?

@tato
Copy link
Contributor

tato commented Sep 18, 2022

Happens here as well, only with resizable OFF. I counted 10 pixels on my end.

I tried changing back and forth from resizable to non-resizable with the following snippet triggered by an input. It clearly adds the extra 10 pixels when the flag is set to true, and removes them when the flag is false.

var flag = DisplayServer.window_get_flag(DisplayServer.WINDOW_FLAG_RESIZE_DISABLED)
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_RESIZE_DISABLED, not flag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants