Skip to content

Commit 68682a8

Browse files
committed
fix(OSK): regression where backspace and other non-unicode keys would be sent
1 parent 756e57c commit 68682a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/ui/common/osk/on_screen_keyboard.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum MODE_SHIFT {
3232
@export var instance: KeyboardInstance = preload("res://core/global/keyboard_instance.tres")
3333
var _mode_shift: MODE_SHIFT = MODE_SHIFT.OFF
3434
var _last_input_focus: int
35-
var logger := Log.get_logger("OSK")
35+
var logger := Log.get_logger("OSK", Log.LEVEL.INFO)
3636

3737
@onready var rows_container := $%KeyboardRowsContainer as VBoxContainer
3838

@@ -369,6 +369,7 @@ func _handle_native(key: KeyboardKeyConfig) -> void:
369369
logger.warn("Keyboard target not set, nowhere to send key input.")
370370
return
371371
var target = instance.context.target
372+
logger.debug("Found target:", target)
372373

373374
# Get the input event based on mode shift
374375
var event := key.input
@@ -377,12 +378,13 @@ func _handle_native(key: KeyboardKeyConfig) -> void:
377378

378379
# Get the character to send to the target
379380
var character := String.chr(event.unicode)
381+
logger.debug("Found character to send:", character)
380382
if _mode_shift == MODE_SHIFT.ONE_SHOT:
381383
set_mode_shift(MODE_SHIFT.OFF)
382384

383385
# If no character was found for the key, then it is a special character
384386
# like shift, alt, etc.
385-
if character == "":
387+
if event.unicode == 0 or character == "":
386388
_handle_native_action(key)
387389
return
388390

0 commit comments

Comments
 (0)