Skip to content

Commit

Permalink
sdl2: fix back button: give back focus to main surface
Browse files Browse the repository at this point in the history
when software keyboard disappears, main view would not have focus

see method (1) in
spesmilo/electrum#6276 (comment)
  • Loading branch information
SomberNight committed May 1, 2021
1 parent be4fa2f commit d81594b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@
SDLActivity.nativeRunMain(library, function, arguments);

Log.v("SDL", "Finished main function");
@@ -1993,6 +2018,9 @@ class DummyEdit extends View implements View.OnKeyListener {
if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
if (SDLActivity.mTextEdit != null && SDLActivity.mTextEdit.getVisibility() == View.VISIBLE) {
SDLActivity.onNativeKeyboardFocusLost();
+ // if targetSdkVersion >= 28, we explicitly need to give back focus
+ // see https://github.com/spesmilo/electrum/issues/6276
+ SDLActivity.mSurface.requestFocus();
}
}
return super.onKeyPreIme(keyCode, event);
@@ -2002,7 +2028,7 @@
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);
Expand Down

0 comments on commit d81594b

Please sign in to comment.