Add device orientation change signal in DisplayServer

This PR:
- Fixes the orientation detection logic on Android
- Adds an orientation_changed signal in DisplayServer

Co-Authored-By: bruvzg <7645683+bruvzg@users.noreply.github.com>
This commit is contained in:
Anish Kumar 2026-01-27 15:22:27 +05:30
parent a4bbad2ba8
commit e2369a834b
7 changed files with 38 additions and 8 deletions

View file

@ -630,7 +630,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererPaused(JNIE
}
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onScreenRotationChange(JNIEnv *env, jclass clazz, jint p_orientation) {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onOrientationChange(JNIEnv *env, jclass clazz, jint p_orientation) {
if (step.get() <= STEP_SETUP) {
return;
}
@ -639,6 +639,11 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onScreenRotationChang
if (camera_server) {
camera_server->handle_display_rotation_change(p_orientation);
}
DisplayServer *display_server = DisplayServer::get_singleton();
if (display_server) {
display_server->emit_signal("orientation_changed", p_orientation);
}
}
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_shouldDispatchInputToRenderThread(JNIEnv *env, jclass clazz) {