Fix back key not being intercepted

This commit is contained in:
SerpentSpirale 2021-11-19 17:42:56 +01:00 committed by Boulay Mathias
parent 2a12db6216
commit 165cc2a8f0

View File

@ -350,10 +350,12 @@ public class BaseMainActivity extends LoggableActivity {
}
@Override
public void onBackPressed() {
// Prevent back
// Catch back as Esc keycode at another place
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && !touchCharInput.isEnabled()) {
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
return true;
}
return super.dispatchKeyEvent(event);
}
public static void switchKeyboardState() {