DisplayServer.virtual_keyboard_get_height() returns incorrect value.

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

In my main project, DisplayServer.virtual_keyboard_get_height() returns a value that is always -54 of what it should be.

If the keyboard isn’t displayed, then the value is -54. If it is displayed, then the value is 54 less than its actual height.

Does anyone know what could be causing this? It only happens in my mature project that I upgrade from Godot 3. I stripped it down to a barebones project file and a basic, empty scene that just prints the height and I still have this issue.

:bust_in_silhouette: Reply From: Shota-Lab

Does anyone know what causes this? This issue only occurs in mature projects upgrading from Godot 3. I’ve even removed the bare-bones project files and a basic empty scene that just prints the height, but the problem still occurs.

I have no idea.
I notice it works fine with my phone using Android 13.
It fails when using my older phone with Android 9 and when using an emulator with Android API 24.
This is also with a mature project being upgraded from Godot 3.
The values reported are different, -54 and -63 respectively.
I’m going to implement a hack that just checks if the absolute value is less than, say 200, and judge if the keyboard is open that way.

blurrred | 2023-06-16 15:32