From 69db35c493aa3a6a9f17094bf2180a52ffb2358e Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 29 Oct 2010 18:59:37 +0900 Subject: [PATCH] Make the buttons work for edge pixels of the keyboard Follow-up change to If7630b89 bug: 3142416 Change-Id: I2660e3d688eb0490363e460d5b4944c89b8ca35c --- java/src/com/android/inputmethod/latin/LatinKeyboard.java | 4 +++- .../com/android/inputmethod/latin/ProximityKeyDetector.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 096f3e702..45a4a9508 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -797,7 +797,9 @@ public class LatinKeyboard extends Keyboard { if (mCurrentlyInSpace) { return new int[] { mSpaceKeyIndex }; } else { - return super.getNearestKeys(x, y); + // Avoid dead pixels at edges of the keyboard + return super.getNearestKeys(Math.max(0, Math.min(x, getMinWidth() - 1)), + Math.max(0, Math.min(y, getHeight() - 1))); } } diff --git a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java index d17bedb56..325ce674c 100644 --- a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java +++ b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java @@ -83,4 +83,4 @@ class ProximityKeyDetector extends KeyDetector { } return primaryIndex; } -} \ No newline at end of file +}