mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
input: don't invoke keybinding when handler was just closed
This commit is contained in:
parent
351267d8cb
commit
d27b977ab3
@ -77,6 +77,7 @@ class InputManager(
|
||||
}
|
||||
|
||||
private fun onKey(code: KeyCodes, change: KeyChangeTypes) {
|
||||
val handler = this.handler.handler
|
||||
this.handler.onKey(code, change)
|
||||
|
||||
val pressed = when (change) {
|
||||
@ -94,8 +95,7 @@ class InputManager(
|
||||
this.pressed -= code
|
||||
}
|
||||
|
||||
val handler = this.handler.handler
|
||||
bindings.onKey(code, pressed, millis)
|
||||
bindings.onKey(code, pressed, handler, millis)
|
||||
|
||||
if (pressed) {
|
||||
times[code] = millis
|
||||
|
@ -20,6 +20,7 @@ import de.bixilon.minosoft.config.key.KeyActions
|
||||
import de.bixilon.minosoft.config.key.KeyBinding
|
||||
import de.bixilon.minosoft.config.key.KeyCodes
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.gui.rendering.input.InputHandler
|
||||
import de.bixilon.minosoft.gui.rendering.input.key.manager.InputManager
|
||||
import de.bixilon.minosoft.gui.rendering.input.key.manager.binding.actions.KeyActionFilter.Companion.filter
|
||||
|
||||
@ -100,9 +101,7 @@ class BindingsManager(
|
||||
}
|
||||
}
|
||||
|
||||
fun onKey(code: KeyCodes, pressed: Boolean, millis: Long) {
|
||||
val handler = input.handler.handler
|
||||
|
||||
fun onKey(code: KeyCodes, pressed: Boolean, handler: InputHandler?, millis: Long) {
|
||||
for ((name, state) in bindings) {
|
||||
if (handler != null && !state.binding.ignoreConsumer) {
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user