diff options
author | 2010-09-09 14:43:17 +0900 | |
---|---|---|
committer | 2010-09-09 20:43:13 +0900 | |
commit | efc4a437942f0bccd8815059c5f9d823023cfac1 (patch) | |
tree | f74e94efbdd11ff92ef871758fbe8fb4834ba516 /java/src/com/android/inputmethod/latin/PointerTracker.java | |
parent | 681b676b0aecb30e644f25550018ce2b6cea3e15 (diff) | |
download | latinime-efc4a437942f0bccd8815059c5f9d823023cfac1.tar.gz latinime-efc4a437942f0bccd8815059c5f9d823023cfac1.tar.xz latinime-efc4a437942f0bccd8815059c5f9d823023cfac1.zip |
Symbol key acts as modifier key
On a device that has distinct multi-touch panel, pressing '123?' key
will change keyboard layout to symbol mode. While pressing '123?'
key, you can press other symbol key to input. Then releasing '123?'
key will change keyboard layout back to alphabet mode.
Bug: 2973383
Change-Id: I3b069fb19141820def8060db4766a08c7c0a6ff0
Diffstat (limited to 'java/src/com/android/inputmethod/latin/PointerTracker.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/PointerTracker.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index 8b1f019d4..e10c9b862 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -111,6 +111,8 @@ public class PointerTracker { throw new IllegalArgumentException(); mKeys = keys; mKeyDebounceThresholdSquared = (int)(hysteresisPixel * hysteresisPixel); + // Update current key index because keyboard layout has been changed. + mCurrentKey = mKeyDetector.getKeyIndexAndNearbyCodes(mStartX, mStartY, null); } private boolean isValidKeyIndex(int keyIndex) { @@ -126,8 +128,8 @@ public class PointerTracker { if (key == null) return false; int primaryCode = key.codes[0]; - // TODO: KEYCODE_MODE_CHANGE (symbol) will be also a modifier key - return primaryCode == Keyboard.KEYCODE_SHIFT; + return primaryCode == Keyboard.KEYCODE_SHIFT + || primaryCode == Keyboard.KEYCODE_MODE_CHANGE; } public void updateKey(int keyIndex) { @@ -173,6 +175,8 @@ public class PointerTracker { } public void onDownEvent(int x, int y, long eventTime) { + if (DEBUG) + debugLog("onDownEvent:", x, y); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); mCurrentKey = keyIndex; mStartX = x; @@ -186,6 +190,8 @@ public class PointerTracker { if (mListener != null) { int primaryCode = isValidKeyIndex(keyIndex) ? mKeys[keyIndex].codes[0] : 0; mListener.onPress(primaryCode); + // This onPress call may have changed keyboard layout and have updated mCurrentKey + keyIndex = mCurrentKey; } if (isValidKeyIndex(keyIndex)) { if (mKeys[keyIndex].repeatable) { @@ -197,11 +203,11 @@ public class PointerTracker { } showKeyPreviewAndUpdateKey(keyIndex); updateMoveDebouncing(x, y); - if (DEBUG) - debugLog("onDownEvent:", x, y); } public void onMoveEvent(int x, int y, long eventTime) { + if (DEBUG_MOVE) + debugLog("onMoveEvent:", x, y); if (mKeyAlreadyProcessed) return; int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); @@ -242,15 +248,13 @@ public class PointerTracker { */ showKeyPreviewAndUpdateKey(isMinorTimeBounce() ? mLastKey : mCurrentKey); updateMoveDebouncing(x, y); - if (DEBUG_MOVE) - debugLog("onMoveEvent:", x, y); } public void onUpEvent(int x, int y, long eventTime) { - if (mKeyAlreadyProcessed) - return; if (DEBUG) debugLog("onUpEvent :", x, y); + if (mKeyAlreadyProcessed) + return; mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); @@ -384,8 +388,11 @@ public class PointerTracker { // The modifier key, such as shift key, should not be shown as preview when multi-touch is // supported. On thge other hand, if multi-touch is not supported, the modifier key should // be shown as preview. - if (!isModifier() || !mHasDistinctMultitouch) + if (mHasDistinctMultitouch && isModifier()) { + mProxy.showPreview(NOT_A_KEY, this); + } else { mProxy.showPreview(keyIndex, this); + } } private void detectAndSendKey(int index, int x, int y, long eventTime) { @@ -478,7 +485,7 @@ public class PointerTracker { } private void debugLog(String title, int x, int y) { - Key key = getKey(mCurrentKey); + Key key = getKey(mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null)); final String code; if (key == null) { code = "----"; |