From 365f9723ccf2ad3eae427028bbcdfc20f04543dc Mon Sep 17 00:00:00 2001 From: Ico Doornekamp Date: Tue, 31 Jul 2018 18:09:12 +0200 Subject: [PATCH] - in onKeyDown() ignore keys when the Fn key is pressed - in onKeyDown() return false when the key is not handled. The above two changes fix the handling of Fn-key combo's on devices with a physical keyboard, allowing the android system defined fallbacks from `/system/usr/keychars/Generic.kcm` to be properly handled. Fixes #731. Original diagnosis and fix by Konehaltia. --- terminal-view/src/main/java/com/termux/view/TerminalView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminal-view/src/main/java/com/termux/view/TerminalView.java b/terminal-view/src/main/java/com/termux/view/TerminalView.java index feadb25d..598e3dd0 100644 --- a/terminal-view/src/main/java/com/termux/view/TerminalView.java +++ b/terminal-view/src/main/java/com/termux/view/TerminalView.java @@ -600,7 +600,7 @@ public final class TerminalView extends View { if (controlDownFromEvent) keyMod |= KeyHandler.KEYMOD_CTRL; if (event.isAltPressed()) keyMod |= KeyHandler.KEYMOD_ALT; if (event.isShiftPressed()) keyMod |= KeyHandler.KEYMOD_SHIFT; - if (handleKeyCode(keyCode, keyMod)) { + if (!event.isFunctionPressed() && handleKeyCode(keyCode, keyMod)) { if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "handleKeyCode() took key event"); return true; } @@ -619,7 +619,7 @@ public final class TerminalView extends View { if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "KeyEvent#getUnicodeChar(" + effectiveMetaState + ") returned: " + result); if (result == 0) { - return true; + return false; } int oldCombiningAccent = mCombiningAccent;