diff --git a/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt b/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt index 1b4ee47fa..4b912d1b6 100644 --- a/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt +++ b/skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt @@ -1,6 +1,6 @@ package org.jetbrains.skiko -import java.lang.System.getProperty +import java.util.* // TODO maybe we can get rid of global properties, and pass SkiaLayerProperties to Window -> ComposeWindow -> SkiaLayer @Suppress("SameParameterValue") @@ -89,6 +89,19 @@ object SkikoProperties { val macOsOpenGLEnabled: Boolean get() = getProperty("skiko.macos.opengl.enabled")?.toBoolean() ?: false + private val properties = run { + val resourcePropertiesEnabled = System.getProperty("skiko.resource.properties.enabled")?.toBoolean() ?: false + val resources = if (resourcePropertiesEnabled) { + SkikoProperties::class.java.classLoader.getResourceAsStream("skiko.properties") + } else { + null + } + val systemProps = System.getProperties() + if (resources == null) systemProps else Properties(systemProps).apply { load(resources) } + } + + private fun getProperty(key: String): String? = properties.getProperty(key) + internal fun parseRenderApi(text: String?): GraphicsApi { when(text) { "SOFTWARE_COMPAT" -> return GraphicsApi.SOFTWARE_COMPAT