fix: update java-gi and, in doing so, fix segfault

This commit is contained in:
Johannes Frohnmeyer 2023-10-16 16:00:57 +02:00
parent e14294fdd6
commit 04d8121ca2
Signed by: Johannes
GPG Key ID: E76429612C2929F4
10 changed files with 15 additions and 31 deletions

View File

@ -17,7 +17,7 @@ val jbAnnotationsVersion by extra("24.0.1")
val lwjglVersion by extra("3.3.2")
val imguiVersion by extra("1.86.10")
// launcher-gtk
val javagiVersion by extra("0.6.1")
val javagiVersion by extra("0.7.2")
val flavorProp: String by extra(prop("flavor", "custom"))
if (!setOf("custom", "maven", "fat", "windows", "linux", "macos").contains(flavorProp)) throw IllegalStateException("Unsupported flavor: $flavorProp")

View File

@ -17,20 +17,14 @@ samWithReceiver {
repositories {
mavenLocal()
maven("https://jitpack.io") {
content {
includeGroup("com.github.jwharm.java-gi")
includeGroup("com.github.jwharm")
}
}
}
dependencies {
val javagiVersion: String by rootProject.extra
implementation("com.github.jwharm.java-gi:glib:$javagiVersion")
implementation("com.github.jwharm.java-gi:gtk:$javagiVersion")
implementation("com.github.jwharm.java-gi:adwaita:$javagiVersion")
implementation("io.github.jwharm.javagi:glib:$javagiVersion")
implementation("io.github.jwharm.javagi:gtk:$javagiVersion")
implementation("io.github.jwharm.javagi:adw:$javagiVersion")
implementation(project(":launcher"))
}

View File

@ -1,6 +1,5 @@
package io.gitlab.jfronny.inceptum.gtk.control
import io.gitlab.jfronny.inceptum.gtk.util.kText
import org.gnome.gtk.Entry
import java.util.function.Consumer
@ -8,7 +7,7 @@ class KEntry(value: String? = ""): Entry() {
private val onChange = ArrayList<Consumer<String>>()
init {
kText = value ?: ""
text = value ?: ""
onChanged { onChange.forEach { it.accept(text) } }
}

View File

@ -1,13 +1,13 @@
package io.gitlab.jfronny.inceptum.gtk.control
import io.github.jwharm.javagi.base.Signal
import io.github.jwharm.javagi.gobject.SignalConnection
import org.gnome.gtk.ListItem
import org.gnome.gtk.SignalListItemFactory
import org.gnome.gtk.StringObject
import org.gnome.gtk.Widget
abstract class KSignalListItemFactory<TData, TWidget : Widget> : SignalListItemFactory() {
private val toDisconnect: MutableMap<String, MutableSet<Signal<*>>> = HashMap()
private val toDisconnect: MutableMap<String, MutableSet<SignalConnection<*>>> = HashMap()
init {
onSetup {
val li = it as ListItem
@ -41,14 +41,14 @@ abstract class KSignalListItemFactory<TData, TWidget : Widget> : SignalListItemF
}
interface BindContext: ActionContext {
fun registerForUnbind(signal: Signal<*>)
fun registerForUnbind(signal: SignalConnection<*>)
}
interface UnbindContext: ActionContext {
}
private inner class BindContextImpl(private val id: String, override val listItem: ListItem) : BindContext {
override fun registerForUnbind(signal: Signal<*>) {
override fun registerForUnbind(signal: SignalConnection<*>) {
toDisconnect.computeIfAbsent(id) { _ -> HashSet() }
.add(signal)
}

View File

@ -31,12 +31,4 @@ var MessageDialog.markup: String
fun ActionRow.fixSubtitle() = ILabel.theme(firstChild!!.lastChild!!.prevSibling!!.lastChild as Label, ILabel.Mode.SUBTITLE)
// Work around a segfault with empty entries
var Entry.kText: String?
get() = text
set(value) {
if (value == "") buffer.clear()
else text = value
}
fun EntryBuffer.clear() = deleteText(0, length)

View File

@ -10,7 +10,6 @@ import io.gitlab.jfronny.inceptum.gtk.control.assistant.KAssistant
import io.gitlab.jfronny.inceptum.gtk.schedule
import io.gitlab.jfronny.inceptum.gtk.util.I18n
import io.gitlab.jfronny.inceptum.gtk.util.Log
import io.gitlab.jfronny.inceptum.gtk.util.kText
import io.gitlab.jfronny.inceptum.gtk.util.toTypedArray
import io.gitlab.jfronny.inceptum.gtk.window.dialog.ProcessStateWatcherDialog
import io.gitlab.jfronny.inceptum.launcher.api.FabricMetaApi
@ -104,7 +103,7 @@ class NewInstanceWindow(app: Application) : KAssistant(app) {
append(entry)
onOpen {
name = InstanceNameTool.getDefaultName(gameVersion!!.id, useFabric)
entry.kText = name
entry.text = name
}
setComplete(true)

View File

@ -1,6 +1,5 @@
package io.gitlab.jfronny.inceptum.gtk.window.dialog
import io.gitlab.jfronny.inceptum.gtk.util.kText
import org.gnome.gtk.*
class StringInputDialog(parent: Window?, flags: DialogFlags, type: MessageType, buttons: ButtonsType, message: String, value: String) : MessageDialog(parent, flags, type, buttons, message) {
@ -8,7 +7,7 @@ class StringInputDialog(parent: Window?, flags: DialogFlags, type: MessageType,
init {
(messageArea as Box).append(entry)
entry.kText = value
entry.text = value
}
val input: String get() = entry.text

View File

@ -147,7 +147,7 @@ class GeneralTab(window: InstanceSettingsWindow) : SectionedSettingsTab<Instance
dialog.onResponse { responseId: Int ->
if (responseId == ResponseType.ACCEPT.value) {
val file = dialog.file!!.path
if (file != null) entry.kText = file
if (file != null) entry.text = file
}
}
dialog.show()

View File

@ -4,7 +4,8 @@ module io.gitlab.jfronny.inceptum.launcher.gtk {
requires kotlin.stdlib;
requires org.gnome.glib;
requires org.gnome.gtk;
requires org.gnome.adwaita;
requires org.gnome.adw;
requires org.gnome.pango;
// Should theoretically already be included transitively through inceptum.launcher and inceptum.common
requires io.gitlab.jfronny.commons;

@ -1 +1 @@
Subproject commit 28770e5269128412d8d51a03aa6c072a8eff10cb
Subproject commit 19ebde77adad3b97e733d98f37a59c828138f53e