diff options
author | Kenny Root <kenny@the-b.org> | 2009-08-12 16:56:20 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-08-12 16:56:20 +0000 |
commit | bb338001612bcb08af57f18191f9c11d0ebf4d35 (patch) | |
tree | d10f66c6f6f954167bc45b5e75014450f4d11e7a /src | |
parent | 03c473ef3e95ee2ad24ce26ef6f738968a8257ce (diff) | |
download | connectbot-bb338001612bcb08af57f18191f9c11d0ebf4d35.tar.gz connectbot-bb338001612bcb08af57f18191f9c11d0ebf4d35.tar.bz2 connectbot-bb338001612bcb08af57f18191f9c11d0ebf4d35.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 19 |
1 files changed, 13 insertions, 6 deletions
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: |