Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backspace not working properly with hardware keyboards #5275

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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