1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Clean up the XR editor logic

- Coalesce common logic into the `main` flavor to avoid duplication
- Code cleanup
This commit is contained in:
Fredia Huya-Kouadio
2025-01-16 09:40:30 -08:00
parent d33da79d3f
commit b4f25b1863
13 changed files with 86 additions and 214 deletions

View File

@@ -68,7 +68,7 @@ public interface GodotRenderView {
* @return true if pointer capture is supported.
*/
default boolean canCapturePointer() {
// Pointer capture is not supported on Horizon OS
return !DeviceUtils.isHorizonOSDevice() && getInputHandler().canCapturePointer();
// Pointer capture is not supported on native XR devices.
return !DeviceUtils.isNativeXRDevice(getView().getContext()) && getInputHandler().canCapturePointer();
}
}

View File

@@ -35,13 +35,14 @@
package org.godotengine.godot.utils
import android.content.Context
import android.os.Build
/**
* Returns true if running on Meta Horizon OS.
*/
fun isHorizonOSDevice(): Boolean {
return "Oculus".equals(Build.BRAND, true)
fun isHorizonOSDevice(context: Context): Boolean {
return context.packageManager.hasSystemFeature("oculus.hardware.standalone_vr")
}
/**
@@ -54,6 +55,6 @@ fun isPicoOSDevice(): Boolean {
/**
* Returns true if running on a native Android XR device.
*/
fun isNativeXRDevice(): Boolean {
return isHorizonOSDevice() || isPicoOSDevice()
fun isNativeXRDevice(context: Context): Boolean {
return isHorizonOSDevice(context) || isPicoOSDevice()
}