Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 691f1c17 authored by satok's avatar satok
Browse files

Fix coordinates sent to native code

Change-Id: I2c8b093b59ad36ffe860c3c4d360d87251d101c4
parent 231ef8fa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -65,11 +65,11 @@ public class KeyDetector {
        return mKeyHysteresisDistanceSquared;
    }

    protected int getTouchX(int x) {
    public int getTouchX(int x) {
        return x + mCorrectionX;
    }

    protected int getTouchY(int y) {
    public int getTouchY(int y) {
        return y + mCorrectionY;
    }

+14 −8
Original line number Diff line number Diff line
@@ -123,21 +123,27 @@ public class WordComposer {
    }

    // TODO: remove input keyDetector
    public void add(int primaryCode, int keyX, int keyY, KeyDetector keyDetector) {
    public void add(int primaryCode, int x, int y, KeyDetector keyDetector) {
        final int[] codes;
        if (keyX == KeyboardActionListener.SPELL_CHECKER_COORDINATE
                || keyY == KeyboardActionListener.SPELL_CHECKER_COORDINATE) {
        final int keyX;
        final int keyY;
        if (x == KeyboardActionListener.SPELL_CHECKER_COORDINATE
                || y == KeyboardActionListener.SPELL_CHECKER_COORDINATE) {
            // only used for tests in InputLogicTests
            addKeyForSpellChecker(primaryCode, AndroidSpellCheckerService.SCRIPT_LATIN);
            return;
        } else if (keyX == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
                || keyY == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
                || keyX == KeyboardActionListener.NOT_A_TOUCH_COORDINATE
                || keyY == KeyboardActionListener.NOT_A_TOUCH_COORDINATE) {
        } else if (x == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
                || y == KeyboardActionListener.SUGGESTION_STRIP_COORDINATE
                || x == KeyboardActionListener.NOT_A_TOUCH_COORDINATE
                || y == KeyboardActionListener.NOT_A_TOUCH_COORDINATE) {
            codes = new int[] { primaryCode };
            keyX = x;
            keyY = y;
        } else {
            codes = keyDetector.newCodeArray();
            keyDetector.getKeyAndNearbyCodes(keyX, keyY, codes);
            keyDetector.getKeyAndNearbyCodes(x, y, codes);
            keyX = keyDetector.getTouchX(x);
            keyY = keyDetector.getTouchX(y);
        }
        add(primaryCode, codes, keyX, keyY);
    }