Skip to content

Commit

Permalink
Keep adding interop order consistent betwen platforms (#1143)
Browse files Browse the repository at this point in the history
## Proposed Changes

- Inserting interop views in the reverse order to get direct order
rendering. It's a hotfix to restore [1.5.x
behaviour](https://github.com/JetBrains/compose-multiplatform-core/blob/v1.5.12/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeWindowDelegate.desktop.kt#L77),
the right order should rely on _rendering_, not adding order in the
future.

## Testing

Test: run repruduction from the issue or "nasa" demo from this commit
MatkovIvan@6a3663d
(not in the main repo because it requires manually added jar)

## Issues Fixed

Fixes
JetBrains/compose-multiplatform#1521 (comment)
  • Loading branch information
MatkovIvan authored Feb 27, 2024
1 parent aac98cd commit 71947f6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,15 @@ internal class ComposeSceneMediator(

@OptIn(ExperimentalSkikoApi::class)
private fun JLayeredPane.addToLayer(component: Component, layer: Int) {
val index = 0 // AWT renders it in the reverse order, so insert it to beginning
if (renderApi == GraphicsApi.METAL && contentComponent !is SkiaSwingLayer) {
// Applying layer on macOS makes our bridge non-transparent
// But it draws always on top, so we can just add it as-is
// TODO: Figure out why it makes difference in transparency
add(component, 0)
add(component, index)
} else {
setLayer(component, layer)
add(component, null, -1)
add(component, null, index)
}
}

Expand Down

0 comments on commit 71947f6

Please sign in to comment.