From 53805913211d98aa4a704adca402cb3970b5aa08 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 13 Feb 2012 20:13:39 -0600 Subject: [PATCH 2/4] device specific keys redux: htc detail This makes more punctuation available by overloading the following keys: shift fn ctrl , [ < { . ] > } @ ` ^ ~ ? (!) | \ --- .../connectbot/service/TerminalKeyListener.java | 25 ++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/src/org/connectbot/service/TerminalKeyListener.java b/src/org/connectbot/service/TerminalKeyListener.java index e5eba41..a41057d 100644 --- a/src/org/connectbot/service/TerminalKeyListener.java +++ b/src/org/connectbot/service/TerminalKeyListener.java @@ -61,6 +61,10 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha public final static int KEYCODE_ESCAPE = 111; public final static int HC_META_CTRL_ON = 4096; + // HTC Speedy-specific constant + public final static int KEYCODE_SPEEDY_QUESTION = 105; // KeyEvent.KEYCODE_BUTTON_R2 + public final static int KEYCODE_SPEEDY_PERIOD = 99; // KeyEvent.KEYCODE_BUTTON_X + // All the transient key codes public final static int META_TRANSIENT = META_CTRL_ON | META_ALT_ON | META_SHIFT_ON; @@ -187,6 +191,27 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha } int key = event.getUnicodeChar(curMetaState); + if(keyCode == KeyEvent.KEYCODE_COMMA) { + if((metaState & META_CTRL_MASK) != 0) key = '{'; + else if((metaState & META_SHIFT_MASK) != 0) key = '['; + else if((metaState & META_ALT_MASK) != 0) key = '<'; + } + else if(keyCode == KEYCODE_SPEEDY_PERIOD) { + if((metaState & META_CTRL_MASK) != 0) key = '}'; + else if((metaState & META_SHIFT_MASK) != 0) key = ']'; + else if((metaState & META_ALT_MASK) != 0) key = '>'; + } + else if(keyCode == KeyEvent.KEYCODE_AT) { + if((metaState & META_CTRL_MASK) != 0) key = '~'; + else if((metaState & META_SHIFT_MASK) != 0) key = '`'; + else if((metaState & META_ALT_MASK) != 0) key = '^'; + } + else if(keyCode == KEYCODE_SPEEDY_QUESTION) { + if((metaState & META_CTRL_MASK) != 0) { key = '\\'; metaState &= ~META_CTRL_MASK; } + else if((metaState & META_SHIFT_MASK) != 0) key = '|'; + else if((metaState & META_ALT_MASK) != 0) key = '!'; + } + // no hard keyboard? ALT-k should pass through to below if ((orgMetaState & KeyEvent.META_ALT_ON) != 0 && (!hardKeyboard || hardKeyboardHidden)) { -- 1.7.2.5