mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -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) {
|
private fun onKey(code: KeyCodes, change: KeyChangeTypes) {
|
||||||
|
val handler = this.handler.handler
|
||||||
this.handler.onKey(code, change)
|
this.handler.onKey(code, change)
|
||||||
|
|
||||||
val pressed = when (change) {
|
val pressed = when (change) {
|
||||||
@ -94,8 +95,7 @@ class InputManager(
|
|||||||
this.pressed -= code
|
this.pressed -= code
|
||||||
}
|
}
|
||||||
|
|
||||||
val handler = this.handler.handler
|
bindings.onKey(code, pressed, handler, millis)
|
||||||
bindings.onKey(code, pressed, millis)
|
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
times[code] = millis
|
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.KeyBinding
|
||||||
import de.bixilon.minosoft.config.key.KeyCodes
|
import de.bixilon.minosoft.config.key.KeyCodes
|
||||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
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.InputManager
|
||||||
import de.bixilon.minosoft.gui.rendering.input.key.manager.binding.actions.KeyActionFilter.Companion.filter
|
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) {
|
fun onKey(code: KeyCodes, pressed: Boolean, handler: InputHandler?, millis: Long) {
|
||||||
val handler = input.handler.handler
|
|
||||||
|
|
||||||
for ((name, state) in bindings) {
|
for ((name, state) in bindings) {
|
||||||
if (handler != null && !state.binding.ignoreConsumer) {
|
if (handler != null && !state.binding.ignoreConsumer) {
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user