From 3d2d62ca47485d13cefad3063bbddd671fd1906c Mon Sep 17 00:00:00 2001 From: xiaoshen Date: Sun, 23 Jan 2022 03:18:04 -0600 Subject: [PATCH] Add more info about lwjgl intergration --- experimental/lwjgl-integration/README.md | 36 +++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/experimental/lwjgl-integration/README.md b/experimental/lwjgl-integration/README.md index 3e9ea3ebeb..c54ae3cac8 100644 --- a/experimental/lwjgl-integration/README.md +++ b/experimental/lwjgl-integration/README.md @@ -5,4 +5,38 @@ Note that: - not all features are implemented - not all features are currently supported (Accessibility, Input Methods) - to pass some event information it is needed to pass it via AWT events (java.awt.KeyEvent and java.awt.MouseEvent). In the future versions of Compose we plan to get rid of the need of AWT events. -- it has bugs (it doesn't show cursor in TextField) \ No newline at end of file + + + +## Problems + +### Cursor In TextField +This is easy, you need to provide `androidx.compose.ui.platform.WindowInfo` in CompositionLocal + +For example: +```kotlin +CompositionLocalProvider( + LocalWindowInfo provides object : WindowInfo { override val isWindowFocused: Boolean = true } +) { + // Your App +} +``` + + +### Popup +Since Compose still use some awt events (https://github.com/JetBrains/compose-jb/issues/1736), you can provide a fake contaniner. + +```kotlin +val awtContainer = object : Container() {} + +// call it when your custom compose app changes winodw position +fun onWindowUpdate(x: Int, y: Int, width: Int, height: Int) { + awtContainer.setBounds(x, y, width, height); +} + +CompositionLocalProvider( + LocalLayerContainer provides awtContainer +) { + // Your App +} +```