You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I know that this is a weird request, so feel free to just say no, but I was wondering if you will be open to help the gtk-kt project ^^
The gtk-kt project is focused on Kotlin native, and not JNA so isn't exactly a direct competitor of your project.
Currently there is only one maintainer that started writing the bindings manually but now he's working on a GIR generator for the Kotlin native code. But it isn't an easy task to do without previous knowledge of GIR so I was wondering if you could help us.
If you are wondering who am I, I'm just an Android developer that would love to be able to write GTK application in Koltin native. I started contributing to the gtk-kt project, very recently and, since I do not have a lot of C interop knowledge, my contributions are mostly on Gradle and pure Kotlin code level. And maybe a little of PR ^^.
Hi,
GTK bindings for Kotlin native sounds interesting to me. However I have no experience with Kotlin native so far.
What is the desired output of that "GIR generator"? Will it be Kotlin code? And if so how will it link to the C-Library? Will it call an autogenerated "cinterop" API?
Hi, GTK bindings for Kotlin native sounds interesting to me. However I have no experience with Kotlin native so far.
What is the desired output of that "GIR generator"? Will it be Kotlin code? And if so how will it link to the C-Library? Will it call an autogenerated "cinterop" API?
It will can an auto generated cinterop API. The Kotlin multi platform stack generates these plugins via definition files that point to relevant headers and other C related information.
The main goal on my side is to get Kotlin/Native generation up and running. But I also want to eventually create Java bindings as well under the tree.
This is an example of a generated kotlin native class:
packageorg.gtkimportglib.gintimportgtk.GtkBoximportgtk.gtk_box_appendimportgtk.gtk_box_get_baseline_positionimportgtk.gtk_box_get_homogeneousimportgtk.gtk_box_get_spacingimportgtk.gtk_box_insert_child_afterimportgtk.gtk_box_prependimportgtk.gtk_box_removeimportgtk.gtk_box_reorder_child_afterimportgtk.gtk_box_set_baseline_positionimportgtk.gtk_box_set_homogeneousimportgtk.gtk_box_set_spacingimportkotlin.Booleanimportkotlin.Intimportkotlin.Unitimportkotlinx.cinterop.CPointerimportkotlinx.cinterop.reinterpretimportorg.gtk.Accessibleimportorg.gtk.BaselinePositionimportorg.gtk.Buildableimportorg.gtk.ConstraintTargetimportorg.gtk.Orientableimportorg.gtk.Widgetimportorg.gtk.glib.boolimportorg.gtk.glib.gtk/** * The `GtkBox` widget arranges child widgets into a single row or column. * *  * * Whether it is a row or column depends on the value of its * [property@Gtk.Orientable:orientation] property. Within the other * dimension, all children are allocated the same size. Of course, the * [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] properties * can be used on the children to influence their allocation. * * Use repeated calls to [method@Gtk.Box.append] to pack widgets into a * `GtkBox` from start to end. Use [method@Gtk.Box.remove] to remove widgets * from the `GtkBox`. [method@Gtk.Box.insert_child_after] can be used to add * a child at a particular position. * * Use [method@Gtk.Box.set_homogeneous] to specify whether or not all children * of the `GtkBox` are forced to get the same amount of space. * * Use [method@Gtk.Box.set_spacing] to determine how much space will be minimally * placed between all children in the `GtkBox`. Note that spacing is added * *between* the children. * * Use [method@Gtk.Box.reorder_child_after] to move a child to a different * place in the box. * * # CSS nodes * * `GtkBox` uses a single CSS node with name box. * * # Accessibility * * `GtkBox` uses the %GTK_ACCESSIBLE_ROLE_GROUP role.*/publicopenclassBox(
publicvalboxPointer:CPointer<GtkBox>,
) : Widget(boxPointer.reinterpret()), Accessible, Buildable, ConstraintTarget, Orientable {
publicoverridevalAccessiblePointer:CPointer<GtkAccessible> = boxPointer.reinterpret()
publicoverridevalBuildablePointer:CPointer<GtkBuildable> = boxPointer.reinterpret()
publicoverridevalConstraintTargetPointer:CPointer<GtkConstraintTarget> =
boxPointer.reinterpret()
publicoverridevalOrientablePointer:CPointer<GtkOrientable> = boxPointer.reinterpret()
/** * The position of the baseline aligned widgets if extra space is available.*/publicvar baselinePosition:BaselinePosition/** * Gets the value set by gtk_box_set_baseline_position().*/
get() {
val cReturn = gtk_box_get_baseline_position(boxPointer)
return cReturn!!.let { gtk ->BaselinePosition.valueOf(gtk)
}
}
/** * Sets the baseline position of a box. * * This affects only horizontal boxes with at least one baseline * aligned child. If there is more vertical space available than * requested, and the baseline is not allocated by the parent then * @position is used to allocate the baseline with respect to the * extra space available.*/
set(position) {
gtk_box_set_baseline_position(boxPointer, position.value)
}
/** * Whether the children should all be the same size.*/publicvar homogeneous:Boolean/** * Returns whether the box is homogeneous (all children are the * same size).*/
get() {
val cReturn = gtk_box_get_homogeneous(boxPointer)
return cReturn!!.bool
}
/** * Sets whether or not all children of @box are given equal space * in the box.*/
set(homogeneous) {
gtk_box_set_homogeneous(boxPointer, homogeneous.gtk)
}
/** * The amount of space between children.*/publicvar spacing:Int/** * Gets the value set by gtk_box_set_spacing().*/
get() {
val cReturn = gtk_box_get_spacing(boxPointer)
return cReturn!!
}
/** * Sets the number of pixels to place between children of @box.*/
set(spacing) {
gtk_box_set_spacing(boxPointer, spacing)
}
/** * Adds @child as the last child to @box.*/publicfunappend(child:Widget): Unit {
gtk_box_append(boxPointer, child.pointer.reinterpret())
}
/** * Inserts @child in the position after @sibling in the list * of @box children. * * If @sibling is %NULL, insert @child at the first position.*/publicfuninsertChildAfter(child:Widget, sibling:Widget): Unit {
gtk_box_insert_child_after(boxPointer, child.pointer.reinterpret(), sibling.pointer.reinterpret())
}
/** * Adds @child as the first child to @box.*/publicfunprepend(child:Widget): Unit {
gtk_box_prepend(boxPointer, child.pointer.reinterpret())
}
/** * Removes a child widget from @box. * * The child must have been added before with * [method@Gtk.Box.append], [method@Gtk.Box.prepend], or * [method@Gtk.Box.insert_child_after].*/publicfunremove(child:Widget): Unit {
gtk_box_remove(boxPointer, child.pointer.reinterpret())
}
/** * Moves @child to the position after @sibling in the list * of @box children. * * If @sibling is %NULL, move @child to the first position.*/publicfunreorderChildAfter(child:Widget, sibling:Widget): Unit {
gtk_box_reorder_child_after(boxPointer, child.pointer.reinterpret(),
sibling.pointer.reinterpret())
}
publiccompanionobject {
publicfun CPointer<GtkBox>?.wrap(): Box?=this?.wrap()
publicfun CPointer<GtkBox>.wrap(): Box=Box(this)
}
}
If you want to try the generator yourself you can checkout this project: https://gitlab.com/gtk-kt/gir-kt
Simply run ./gradlew run, the generated code will be available in build/gir-kt.
Currently the generated code isn't complete and doesn't work yet, we are still trying to squash some bugs, that's why your help would be great since you have already a lot of experience with GIR generation!
If you want to jump in for a chat with us, we are available on the official Matrix instance for the project: https://matrix.to/#/#gtk-kt:matrix.org
But if you prefer to chat somewhere else, let me know!
Repository owner locked and limited conversation to collaborators on Mar 21, 2023
Activity
bailuk commentedon Feb 9, 2023
Hi,
GTK bindings for Kotlin native sounds interesting to me. However I have no experience with Kotlin native so far.
What is the desired output of that "GIR generator"? Will it be Kotlin code? And if so how will it link to the C-Library? Will it call an autogenerated "cinterop" API?
Doomsdayrs commentedon Feb 9, 2023
It will can an auto generated cinterop API. The Kotlin multi platform stack generates these plugins via definition files that point to relevant headers and other C related information.
The main goal on my side is to get Kotlin/Native generation up and running. But I also want to eventually create Java bindings as well under the tree.
leinardi commentedon Feb 9, 2023
Hi @bailuk thank you for coming back to us!
This is an example of a generated kotlin native class:
If you want to try the generator yourself you can checkout this project: https://gitlab.com/gtk-kt/gir-kt
Simply run
./gradlew run, the generated code will be available inbuild/gir-kt.Currently the generated code isn't complete and doesn't work yet, we are still trying to squash some bugs, that's why your help would be great since you have already a lot of experience with GIR generation!
If you want to jump in for a chat with us, we are available on the official Matrix instance for the project: https://matrix.to/#/#gtk-kt:matrix.org
But if you prefer to chat somewhere else, let me know!