aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/event/Event.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2015-01-16 03:27:10 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-16 03:27:10 +0000
commita0b9e57af47bc20b6fedec802f4ada8c5b5ba8c5 (patch)
tree6bb8da2376fea33accccdf18a9c904cfcf24ccee /java/src/com/android/inputmethod/event/Event.java
parentc0f4d016f776039ff6d0c930c5e51a08b349943b (diff)
parent9fe700ec4fceba1e061733795bc89ca9d0620525 (diff)
downloadlatinime-a0b9e57af47bc20b6fedec802f4ada8c5b5ba8c5.tar.gz
latinime-a0b9e57af47bc20b6fedec802f4ada8c5b5ba8c5.tar.xz
latinime-a0b9e57af47bc20b6fedec802f4ada8c5b5ba8c5.zip
am 9fe700ec: Merge "Fix moving the cursor inside composition in lang w/o spaces"
* commit '9fe700ec4fceba1e061733795bc89ca9d0620525': Fix moving the cursor inside composition in lang w/o spaces
Diffstat (limited to 'java/src/com/android/inputmethod/event/Event.java')
-rw-r--r--java/src/com/android/inputmethod/event/Event.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/event/Event.java b/java/src/com/android/inputmethod/event/Event.java
index a1226dc93..e3b1afc53 100644
--- a/java/src/com/android/inputmethod/event/Event.java
+++ b/java/src/com/android/inputmethod/event/Event.java
@@ -58,6 +58,8 @@ public class Event {
final public static int EVENT_TYPE_SUGGESTION_PICKED = 5;
// An event corresponding to a string generated by some software process.
final public static int EVENT_TYPE_SOFTWARE_GENERATED_STRING = 6;
+ // An event corresponding to a cursor move
+ final public static int EVENT_TYPE_CURSOR_MOVE = 7;
// 0 is a valid code point, so we use -1 here.
final public static int NOT_A_CODE_POINT = -1;
@@ -234,6 +236,18 @@ public class Event {
}
/**
+ * Creates an input event representing moving the cursor. The relative move amount is stored
+ * in mX.
+ * @param moveAmount the relative move amount.
+ * @return an event for this cursor move.
+ */
+ @Nonnull
+ public static Event createCursorMovedEvent(final int moveAmount) {
+ return new Event(EVENT_TYPE_CURSOR_MOVE, null, NOT_A_CODE_POINT, NOT_A_KEY_CODE,
+ moveAmount, Constants.NOT_A_COORDINATE, null, FLAG_NONE, null);
+ }
+
+ /**
* Creates an event identical to the passed event, but that has already been consumed.
* @param source the event to copy the properties of.
* @return an identical event marked as consumed.
@@ -291,6 +305,7 @@ public class Event {
case EVENT_TYPE_MODE_KEY:
case EVENT_TYPE_NOT_HANDLED:
case EVENT_TYPE_TOGGLE:
+ case EVENT_TYPE_CURSOR_MOVE:
return "";
case EVENT_TYPE_INPUT_KEYPRESS:
return StringUtils.newSingleCodePointString(mCodePoint);