osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

Investigate necessity of forwarding `OnKey{Up,Down}` events from `Activity` to `View`

Open Susko3 opened this issue 3 years ago • 0 comments

https://github.com/ppy/osu-framework/blob/53de765a2ac7f54cedefba50f797036a7ecf1a9a/osu.Framework.Android/AndroidGameActivity.cs#L141-L157

While working on #5281, a problem similar to the one described above arose. Button inputs were working properly (as they were forwarded), but stick and trigger inputs didn't work. Unless the view was focused (eg. by moving the left stick, which signals to Android to move the focus, and finding AndroidGameView as a possible focus target).

This problem was fixed by explicitly requesting focus on startup in https://github.com/ppy/osu-framework/commit/9f7ba87ebc4c54c88eb75028c8efa417d1f08b2d.

It's very likely that the original keyboard bug happened because the view wasn't focused. Git blame leads to #2877, which doesn't shed much light on the reasoning. The code seems wrong, so I'd have it removed if possible.

Susko3 avatar Jul 01 '22 12:07 Susko3