Kotlin/Native, has a bumpy start for development. ...
# kotlin-native
c
Kotlin/Native, has a bumpy start for development. The learning curve is a tad confusing at times. But overall I have to say I enjoy it. Now that I have gotten past the initial bump, Writing kotlin-gtk has become extremely smooth. It's mostly just the annoying slow wrapping of native -> pure kotlin
p
are you working on a gtk4 wrapper/binding library or what is kotlin-gtk? i am working on my own wrapper generated from gir, but it is a slow and tedius learning process for me. i'd like to see other peoples efforts for this
c
@phisch I'm working on a GTK3 wrapper. I want to do a GTK4 wrapper, but Ubuntu won't be moving to it for a bit. So I rather have a library, that even if based on an older GTK, will run with stuff that is supported on 99% of distros. Here it is, currently I'm just wrapping slowly. But a basic application is plausible with it https://github.com/Doomsdayrs/kotlinx-gtk
p
Although this is not in prime condition, i did manage to get this to work after fixing some stuff in their generator: https://github.com/kropp/kotlin-native-gtk
c
What is the issue with the kotlin native generation? Aside from not generating definitions
p
It's been a couple months for me, so i don't fully remember, but when generating it from the latest gir, some properties where wrong, i got a lot of deprecation warnings and stuff, but it was quite easy to fix in the generator.
i did end up writing a quick and dirty test drawing application with it though, and this worked great: https://gist.github.com/phisch/388e0564e0e059fa9b621bc3372d9d77
although i didn't have cairo a wrapper, so that code is still very c interop like
c
The only issue I have is, well there still is C code interaction. My goal is to make it a pure kotlin only execution, with multiplatform capability Here is my testing program, I'm currently trying to map signals to flows https://github.com/Doomsdayrs/kotlinx-gtk/blob/main/src/nativeTest/kotlin/Main.kt
And just wrap everything in kotlin
p
Yeah but GTK3 has so many libraries that are used with it... It's a ton of work.
Also not a fan of the DSL nesting everyone does. It makes the code harder to read imo.
c
That is very true, alas, I have lots of experience wrapping things. Its honestly a way I relax, by wrapping. The DSL nest tree is annoying to me too, I'm trying to figure out how to split things up
Another annoyance to me is that GTK3 and 4 are so different, and gtk4 is sooo much better in design
p
But yeah for the main GTK stuff, you should look into generating your wrapper from the GIR
GTK4 is in a weird state though... Their new shader backend makes Application statup significantly slower, working with shaders in widgets is not as easy/intuive as it should be, GTK4 apps generally crash a lot (still), and they majorly messed up Wayland support. You could not even write a Dock application because they dropped Layershell support for GTK4. They don't intend to re-implement it, and they aren't supporting community efforts to get it back in. They don't need it since they have their own Wayland compositor and can just invent whatever protocol they need to do layershell-stuff, but for a normal app this would not work.