mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
[compose] IJPL-213469 Skia loading causes UI freezes
(cherry picked from commit e7f9d2f71b2be2188547214bc6f18a7383d42499) (cherry picked from commit a499a3063c5f4e3b8622d1453b85bd80c918b476) IJ-MR-179919 GitOrigin-RevId: 61cffc1bb097419e72bb99fbe4d8d7ed16181ec3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3712549d2d
commit
67648f919b
@@ -25,6 +25,7 @@ jvm_library(
|
||||
"@lib//:jetbrains-annotations",
|
||||
"@lib//:kotlinx-coroutines-core",
|
||||
"@lib//:jetbrains-compose-components-ui-tooling-preview-desktop",
|
||||
"//platform/diagnostic/telemetry",
|
||||
],
|
||||
exports = [
|
||||
"//platform/jewel/ui",
|
||||
@@ -57,6 +58,8 @@ jvm_library(
|
||||
"@lib//:jetbrains-compose-components-ui-tooling-preview-desktop",
|
||||
"@lib//:junit4",
|
||||
"//platform/jewel/int-ui/int-ui-standalone:jewel-intUi-standalone",
|
||||
"//platform/diagnostic/telemetry",
|
||||
"//platform/diagnostic/telemetry:telemetry_test_lib",
|
||||
],
|
||||
exports = [
|
||||
"//platform/jewel/ui",
|
||||
|
||||
@@ -43,5 +43,6 @@
|
||||
<orderEntry type="library" exported="" name="jetbrains.compose.components.ui.tooling.preview.desktop" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.jewel.intUi.standalone" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -6,6 +6,8 @@
|
||||
description="Allows changing how ComposePanel is rendered using rendering on Graphics (when `true`, it provides smooth Swing interop) or on native AWT texture (when `false`). Works only in internal mode"
|
||||
key="compose.swing.render.on.graphics"/>
|
||||
<search.traverseUiHelper implementation="com.intellij.platform.compose.ComposeTraverseUiHelper"/>
|
||||
|
||||
<applicationActivity implementation="com.intellij.platform.compose.SkikoPreloader"/>
|
||||
</extensions>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.compose
|
||||
|
||||
import com.intellij.ide.ApplicationActivity
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.platform.diagnostic.telemetry.Scope
|
||||
import com.intellij.platform.diagnostic.telemetry.TelemetryManager
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.jewel.bridge.setSkikoLibraryPath
|
||||
import org.jetbrains.skiko.Library
|
||||
|
||||
// org.jetbrains.skiko.Library.load seems expensive, better have it loaded before the first rendering happens
|
||||
internal class SkikoPreloader : ApplicationActivity {
|
||||
private val SKIKO: Scope = Scope("skiko")
|
||||
|
||||
override suspend fun execute() {
|
||||
val tracer = TelemetryManager.getInstance().getSimpleTracer(SKIKO)
|
||||
withContext(tracer.span("org.jetbrains.skiko.Library.load")) {
|
||||
thisLogger().debug("Preloading Skiko")
|
||||
|
||||
setSkikoLibraryPath()
|
||||
Library.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-4
@@ -193,10 +193,8 @@ public fun JewelComposeNoThemePanel(
|
||||
public fun JewelComposeNoThemePanel(config: ComposePanel.() -> Unit = {}, content: @Composable () -> Unit): JComponent =
|
||||
JewelComposeNoThemePanel(focusOnClickInside = false, config, content)
|
||||
|
||||
private fun createJewelComposePanel(
|
||||
focusOnClickInside: Boolean,
|
||||
config: ComposePanel.(JewelComposePanelWrapper) -> Unit,
|
||||
): JewelComposePanelWrapper {
|
||||
@ApiStatus.Internal
|
||||
public fun setSkikoLibraryPath() {
|
||||
if (System.getProperty("skiko.library.path") == null) {
|
||||
val bundledSkikoFolder = File(PathManager.getLibPath(), "/skiko-awt-runtime-all")
|
||||
if (bundledSkikoFolder.isDirectory && bundledSkikoFolder.canRead()) {
|
||||
@@ -205,6 +203,14 @@ private fun createJewelComposePanel(
|
||||
JewelLogger.getInstance("SkikoLoader").warn("Bundled Skiko not found/not readable, falling back to default")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createJewelComposePanel(
|
||||
focusOnClickInside: Boolean,
|
||||
config: ComposePanel.(JewelComposePanelWrapper) -> Unit,
|
||||
): JewelComposePanelWrapper {
|
||||
setSkikoLibraryPath()
|
||||
|
||||
val jewelPanel = JewelComposePanelWrapper(focusOnClickInside)
|
||||
jewelPanel.composePanel.config(jewelPanel)
|
||||
ComposeUiInspector(jewelPanel)
|
||||
|
||||
Reference in New Issue
Block a user