From bb338001612bcb08af57f18191f9c11d0ebf4d35 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 12 Aug 2009 16:56:20 +0000 Subject: Ignore shortcuts when no hard keyboard present If the hardware keyboard is not present at all or is hidden (e.g., G1 in Portrait mode), then ignore the directory shortcuts altogether since there's no way for the user to press them. git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@390 df292f66-193f-0410-a5fc-6d59da041ff2 --- src/org/connectbot/service/TerminalBridge.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index a2d6e94..1d69989 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -122,7 +122,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener { private String keymode = null; - private boolean hardwareKeyboard = false; + private boolean hardKeyboard = false; private boolean selectingForCopy = false; private final SelectionArea selectionArea; @@ -268,7 +268,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener { selectionArea = new SelectionArea(); - hardwareKeyboard = (manager.res.getConfiguration().keyboard + hardKeyboard = (manager.res.getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY); } @@ -487,8 +487,13 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener { public boolean onKey(View v, int keyCode, KeyEvent event) { try { + boolean hardKeyboardHidden = + manager.res.getConfiguration().hardKeyboardHidden == + Configuration.HARDKEYBOARDHIDDEN_YES; + // Ignore all key-up events except for the special keys - if (event.getAction() == KeyEvent.ACTION_UP) { + if (event.getAction() == KeyEvent.ACTION_UP && + hardKeyboard && !hardKeyboardHidden) { // skip keys if we aren't connected yet or have been disconnected if (disconnected || transport == null) return false; @@ -568,7 +573,8 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener { metaState &= ~META_CTRL_ON; redraw(); - if (!hardwareKeyboard && sendFunctionKey(keyCode)) + if ((!hardKeyboard || (hardKeyboard && hardKeyboardHidden)) + && sendFunctionKey(keyCode)) return true; // Support CTRL-a through CTRL-z @@ -584,7 +590,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener { } // handle pressing f-keys - if (hardwareKeyboard + if ((hardKeyboard && !hardKeyboardHidden) && (curMetaState & KeyEvent.META_SHIFT_ON) != 0 && sendFunctionKey(keyCode)) return true; @@ -607,7 +613,8 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener { } // try handling keymode shortcuts - if (event.getRepeatCount() == 0) { + if (hardKeyboard && !hardKeyboardHidden && + event.getRepeatCount() == 0) { if (PreferenceConstants.KEYMODE_RIGHT.equals(keymode)) { switch (keyCode) { case KeyEvent.KEYCODE_ALT_RIGHT: -- cgit v1.2.3