You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #110127 from AayushSarikhada/android-back-gesture-fail-fix
Fix Android back gesture failing after keyboard dismissal
This commit is contained in:
@@ -221,7 +221,15 @@ public class GodotEditText extends EditText {
|
||||
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
||||
/* Let SurfaceView get focus if back key is input. */
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
// Clear focus from EditText immediately
|
||||
clearFocus();
|
||||
|
||||
// Transfer focus to render view
|
||||
mRenderView.getView().requestFocus();
|
||||
|
||||
// Forward this back key event to the render view's input handler
|
||||
// since we're no longer the focused view
|
||||
return mRenderView.getInputHandler().onKeyDown(keyCode, keyEvent);
|
||||
}
|
||||
|
||||
// When a hardware keyboard is connected, all key events come through so we can route them
|
||||
@@ -248,6 +256,11 @@ public class GodotEditText extends EditText {
|
||||
return mRenderView.getInputHandler().onKeyUp(keyCode, keyEvent);
|
||||
}
|
||||
|
||||
// If this is a BACK key and we don't have focus anymore, forward to render view
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && !hasFocus()) {
|
||||
return mRenderView.getInputHandler().onKeyUp(keyCode, keyEvent);
|
||||
}
|
||||
|
||||
if (needHandlingInGodot(keyCode, keyEvent) && mRenderView.getInputHandler().onKeyUp(keyCode, keyEvent)) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user