diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-17 10:33:47 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-23 10:10:22 +0100 |
commit | bfe3a47e1e5bb51b7f9440b6155d002eedcea22b (patch) | |
tree | 4abe069df6959ac50b108063d56173482c1f878d /android | |
parent | 0622d2658a8ccadadfb5eb2180a252833c3a9c22 (diff) |
lok::Office::postKeyEvent: allow different char and key code
editeng is not happy with non-zero char code for css::awt::Key::ESCAPE.
Change-Id: If26923df7defb8a47766e9109835a8569067e578
Diffstat (limited to 'android')
-rw-r--r-- | android/Bootstrap/src/org/libreoffice/kit/Office.java | 2 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 25 |
2 files changed, 21 insertions, 6 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Office.java b/android/Bootstrap/src/org/libreoffice/kit/Office.java index 25861c92abfc..f344e21e109e 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Office.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Office.java @@ -39,7 +39,7 @@ public class Office { * @param type - type of key event * @param code - key event code */ - public native void postKeyEvent(int type, int code); + public native void postKeyEvent(int type, int charCode, int keyCode); public native void destroy(); public native void destroyAndExit(); diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 71dd17c442fb..8e7c4f6b9ce1 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -287,6 +287,23 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback this.tileInvalidationCallback = tileInvalidationCallback; } + /** + * Returns the Unicode character generated by this event or 0. + */ + private int getCharCode(KeyEvent keyEvent) { + switch (keyEvent.getKeyCode()) + { + case KeyEvent.KEYCODE_DEL: + case KeyEvent.KEYCODE_ENTER: + return 0; + } + return keyEvent.getUnicodeChar(); + } + + /** + * Returns the integer code representing the key of the event (non-zero for + * control keys). + */ private int getKeyCode(KeyEvent keyEvent) { switch (keyEvent.getKeyCode()) { @@ -295,19 +312,17 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback case KeyEvent.KEYCODE_ENTER: return com.sun.star.awt.Key.RETURN; } - return keyEvent.getUnicodeChar(); + return 0; } @Override public void keyPress(KeyEvent keyEvent) { - int code = getKeyCode(keyEvent); - mOffice.postKeyEvent(Office.KEY_PRESS, code); + mOffice.postKeyEvent(Office.KEY_PRESS, getCharCode(keyEvent), getKeyCode(keyEvent)); } @Override public void keyRelease(KeyEvent keyEvent) { - int code = getKeyCode(keyEvent); - mOffice.postKeyEvent(Office.KEY_RELEASE, code); + mOffice.postKeyEvent(Office.KEY_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); } private void mouseButton(int type, PointF inDocument) { |