More proper mouse grab killing in killfocus

This commit is contained in:
DBotThePony 2023-01-27 11:48:22 +07:00
parent 6ea1edd358
commit 74ade46807
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 13 additions and 3 deletions

View File

@ -1118,15 +1118,25 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
if (isFocused) {
isFocused = false
}
grabMouseInput = false
}
private fun killGrabMouseInput() {
for (child in childrenInternal) {
child.killGrabMouseInput()
}
grabMouseInput = false
}
fun killFocus() {
if (isEverFocused()) {
killFocusInternal()
findAbsoluteRoot().updateFocus()
} else if (isGrabbingMouseInput()) {
killGrabMouseInput()
}
grabMouseInput = false
}
fun findHierarchicalFocus(): EditablePanel<*>? {

View File

@ -1156,7 +1156,7 @@ open class TextInputPanel<out S : Screen>(
cursorCharacter = pos.x
isSelecting = true
grabMouseInput = true
tryToGrabMouseInput()
}
return true