Skip to content

Commit

Permalink
Merge pull request #5275 from Susko3/fix-backspace
Browse files Browse the repository at this point in the history
Fix backspace not working properly with hardware keyboards
  • Loading branch information
smoogipoo authored Jun 29, 2022
2 parents 35536d8 + f5add7a commit e53bbf8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions osu.Framework.Android/AndroidGameView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)

default:
KeyDown?.Invoke(keyCode, e);

// Releasing backspace on a physical keyboard when text input is active will not send a key up event.
// Manually send one to prevent the key from getting stuck.
// This does mean that key repeat is handled by the OS, instead of by the usual `InputManager` handling.
if (keyCode == Keycode.Del && e.IsFromSource(InputSourceType.Keyboard) && textInputActive)
KeyUp?.Invoke(Keycode.Del, new KeyEvent(e.DownTime, e.EventTime, KeyEventActions.Up, Keycode.Del, 0, e.MetaState, e.DeviceId, e.ScanCode, e.Flags, e.Source));

return true;
}
}
Expand Down

0 comments on commit e53bbf8

Please sign in to comment.