Continuing with my try to make `example-cef-compos...
# compose-desktop
m
Continuing with my try to make
example-cef-compose
work. I'm trying to get the HardwareLayer component. As
AppManager
no longer exist, I pass the
window
from the App.kt to the browserView. The problem is that this window has only one component that is not a HardwareLayer. Any idea of how to get the HardwareLayer?
k
Put a breakpoint in
HardwareLayer
constructor and see where it's initialized and added. I'm not seeing that component being in the compose window hierarchy though, so your assumptions might be incorrect
m
I agree with you. Is the sample at the jb repo what seems to indicate that one of the component is a HardwareLayer BrowserView.kt line 126. My guess is that code is too old and now things have deeply chamged.
k
The whole thing with CEF was exploratory very early on, and then effectively abandoned.
x
Got same error on macOS, have it been fixed or some workaround?
k
What error? You're looking at abandoned sample code that hasn't been updated in ages.
x
I can't get HardwareLayer instance to create org.cef.browser.BrowserView provided in jcef-skiko library
k
That whole integration has not been kept up to date with changes in Skiko.
x
Is skiko-jcef open-source?
I take this try but got a runtime ClassCastException:
k
Where is this code taken from?
x
how can i get ComposeLayer from a ComposeWindow?
I search the usages of HardwareLayer and find a use in SkiaLayer:
k
If you're copy pasting code from Compose playground CEF sample, it's not going to work anymore. It was some sample code that has been abandoned long ago.
x
message has been deleted
Yes, I know. But I want to make it work again🤣
k
You can start by looking at the old source code of Skiko back when CEF sample was added, see what that hardware layer was used for, and how the current Skiko structure is different. As well as what CEF needs in terms of a surface to put its content into. It's pretty clear at this point that browser embedding is not a priority for the JB team.
x
Thanks for your good advice.
k
https://github.com/viglucci/app-jcef-example/blob/master/src/main/java/example/simple/SimpleFrameExample.java doesn't look like you need to go into Skiko internals to just put CEF content into the screen. Maybe they intended to have some sort of hardware acceleration for it early on.
x
I have a next step idea: use ComposePanel instead ComposeWindow to create ui in main() function, and then get the HardwareLayer instance by the code showing above.
Big forword: I can get HardwareLayer now: https://github.com/JetBrains/compose-jb/compare/on_kotlin_1.7.0-rc...xiaobailong24:samples/experimental_cef_macOS?expand=1 But got another error, I'll take time to fix it.
👀 1
k
Use the official JDK for now instead of Temurin
🙏 1
m
@xiaobailong24 Hi. I have tested your code and it is a great idea using ComposePanel. I haven't made it work as in macOS M1 (arm64) the native library doesn't initialise. Using the amd64 one with Rosseta the app starts but I get an error that I will continue investigating.
Copy code
initialize on Thread[AWT-EventQueue-0,6,main] with library path /Users/sesmam2/repos/kmpp/composejb/experimental/cef/third_party/java-cef/bin/jcef_app.app/Contents/Java
[0607/102823.704141:ERROR:<http://icu_util.cc|icu_util.cc>(252)] Couldn't mmap icu data file
In Linux (Ubuntu arm64) I haven't been lucky either. Again seems related to the arm architecture:
Copy code
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: /tmp/skija_0.93.1/libskija.so: /tmp/skija_0.93.1/libskija.so: cannot open shared object file: No such file or directory (Possible cause: can't load AMD 64 .so on a AARCH64 platform)
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
x
It seems like similar error. And I haven't fixed it.
https://bitbucket.org/chromiumembedded/java-cef/issues/109/linux-mac-fix-discovery-of-icudtldat find similar issue, but can't work because of the new error:Unrecognized option: --framework-dir-path=xxx
It looks like cef args but not java args. And i'll try to pass it to cef.
Copy code
CefApp.startup()
Is jcef-skiko not open-source?
k
What is jcef-skiko that you are referring to?
x
Copy code
org.jetbrains.jcef:jcef-skiko:0.1
k
Is it https://github.com/JetBrains/jcef? Are you looking for the source code for it?
x
Sorry. jcef-skiko is not jcef. jcef-skiko depends on skiko. https://github.com/JetBrains/skiko
114 Views