https://kotlinlang.org logo
Title
k

Kirill Grouchnikov

10/07/2021, 7:16 PM
@Igor Demin - I just upgraded to build 396, and looks like the version of
ComposeWindow
that gets parent composition is gone. But it's still there in https://github.com/androidx/androidx/blob/androidx-main/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeWindow.desktop.kt#L85. Is there a different branch that 396 is cut from, and if so, what is the new way to propagate all composition locals from the parent window to the new window?
i

Igor Demin

10/08/2021, 9:03 AM
Is there a different branch that 396 is cut from
We build from https://github.com/JetBrains/androidx/tree/jb-main, which contains a new API, that is not yet merged to androidx (we mark it as Experimental), and several bugfixes.
that gets parent composition is gone
Use currentCompositionLocals. It is not a final API though, and probably will be changed soon. We rushed to change it because of the very ugly bug with high CPU usage. Parent composition doesn't work well if we pass it from
application
to
Window
or from
Window
to
Window
(it provides a wrong frame clock), and we decide to remove it from API, until we figure out how to properly fix it (a proper fix isn't trivial)
👍 1
k

Kirill Grouchnikov

10/08/2021, 2:08 PM
Thanks, this works
Resurrecting this, @Igor Demin. In build 418 I get
Unresolved reference: currentCompositionLocals
i

Igor Demin

10/21/2021, 6:33 PM
Yeah, it was changed again to this:
val currentLocalContext by rememberUpdatedState(currentCompositionLocalContext)

...

CompositionLocalProvider(currentLocalContext ) {
    ...
}
It was the last breaking change, as it was merged to aosp )
k

Kirill Grouchnikov

10/21/2021, 6:47 PM
I was looking at the
Window.desktop.kt
sources in
JetBrains/androidx
for reference, but they are still in the "old" world
i

Igor Demin

10/21/2021, 6:52 PM
you can look here
👍 1
@Kirill Grouchnikov News about this feature. If we pass locals not at the top level, we override some important locals. I made a fix in Compose (instead of using
CompositionLocalProvider
directly, use
window.compositionLocalContext =
) Suggest do the same in Aurora 🙂
:thank-you: 1
k

Kirill Grouchnikov

11/12/2021, 1:51 PM
Thanks! Done over here.
👍 1