diff options
| -rw-r--r-- | assets/special_font.ttf | bin | 20868 -> 22924 bytes | |||
| -rw-r--r-- | doc/Possible-key-values.md | 14 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyEventHandler.java | 25 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyModifier.java | 7 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 4 | ||||
| -rw-r--r-- | srcs/special_font/01B.svg | 18 | ||||
| -rw-r--r-- | srcs/special_font/01C.svg | 18 |
7 files changed, 70 insertions, 16 deletions
diff --git a/assets/special_font.ttf b/assets/special_font.ttf Binary files differindex c21ad29..da9274a 100644 --- a/assets/special_font.ttf +++ b/assets/special_font.ttf diff --git a/doc/Possible-key-values.md b/doc/Possible-key-values.md index a5defef..0898341 100644 --- a/doc/Possible-key-values.md +++ b/doc/Possible-key-values.md @@ -87,12 +87,14 @@ These keys are sent to apps, which are free to ignore them. The keyboard does no ## Keyboard editing actions In contrast, these keys perform editing on the text without sending anything to the app. -Value | Meaning -:----------------- | :------ -`cursor_left` | Moves the cursor to the left with the slider gesture. -`cursor_right` | Moves the cursor to the right with the slider gesture. -`cursor_up` | Moves the cursor up with the slider gesture. Warning: this might make the cursor leave the text box. -`cursor_down` | Moves the cursor down with the slider gesture. Warning: this might make the cursor leave the text box. +Value | Meaning +:-------------------- | :------ +`cursor_left` | Moves the cursor to the left with the slider gesture. +`cursor_right` | Moves the cursor to the right with the slider gesture. +`cursor_up` | Moves the cursor up with the slider gesture. Warning: this might make the cursor leave the text box. +`cursor_down` | Moves the cursor down with the slider gesture. Warning: this might make the cursor leave the text box. +`delete_word` | Delete the word to the left of the cursor. +`forward_delete_word` | Delete the word to the right of the cursor. ## Whitespace Value | Meaning diff --git a/srcs/juloo.keyboard2/KeyEventHandler.java b/srcs/juloo.keyboard2/KeyEventHandler.java index 09efd59..a841c30 100644 --- a/srcs/juloo.keyboard2/KeyEventHandler.java +++ b/srcs/juloo.keyboard2/KeyEventHandler.java @@ -146,11 +146,11 @@ public final class KeyEventHandler if (down) { _meta_state = _meta_state | meta_flags; - send_keyevent(KeyEvent.ACTION_DOWN, eventCode); + send_keyevent(KeyEvent.ACTION_DOWN, eventCode, _meta_state); } else { - send_keyevent(KeyEvent.ACTION_UP, eventCode); + send_keyevent(KeyEvent.ACTION_UP, eventCode, _meta_state); _meta_state = _meta_state & ~meta_flags; } } @@ -181,25 +181,28 @@ public final class KeyEventHandler } } - /* - * Don't set KeyEvent.FLAG_SOFT_KEYBOARD. - */ void send_key_down_up(int keyCode) { - send_keyevent(KeyEvent.ACTION_DOWN, keyCode); - send_keyevent(KeyEvent.ACTION_UP, keyCode); + send_key_down_up(keyCode, _meta_state); } - void send_keyevent(int eventAction, int eventCode) + /** Ignores currently pressed system modifiers. */ + void send_key_down_up(int keyCode, int metaState) + { + send_keyevent(KeyEvent.ACTION_DOWN, keyCode, metaState); + send_keyevent(KeyEvent.ACTION_UP, keyCode, metaState); + } + + void send_keyevent(int eventAction, int eventCode, int metaState) { InputConnection conn = _recv.getCurrentInputConnection(); if (conn == null) return; conn.sendKeyEvent(new KeyEvent(1, 1, eventAction, eventCode, 0, - _meta_state, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, + metaState, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE)); if (eventAction == KeyEvent.ACTION_UP) - _autocap.event_sent(eventCode, _meta_state); + _autocap.event_sent(eventCode, metaState); } void send_text(CharSequence text) @@ -236,6 +239,8 @@ public final class KeyEventHandler case REPLACE: send_context_menu_action(android.R.id.replaceText); break; case ASSIST: send_context_menu_action(android.R.id.textAssist); break; case AUTOFILL: send_context_menu_action(android.R.id.autofill); break; + case DELETE_WORD: send_key_down_up(KeyEvent.KEYCODE_DEL, KeyEvent.META_CTRL_ON | KeyEvent.META_CTRL_LEFT_ON); break; + case FORWARD_DELETE_WORD: send_key_down_up(KeyEvent.KEYCODE_FORWARD_DEL, KeyEvent.META_CTRL_ON | KeyEvent.META_CTRL_LEFT_ON); break; } } diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index c9de407..bb33cca 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -381,6 +381,13 @@ public final class KeyModifier case SHIFT: name = "capslock"; break; } break; + case Keyevent: + switch (k.getKeyevent()) + { + case KeyEvent.KEYCODE_DEL: name = "delete_word"; break; + case KeyEvent.KEYCODE_FORWARD_DEL: name = "forward_delete_word"; break; + } + break; } return (name == null) ? k : KeyValue.getKeyByName(name); } diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 2c5a03b..413520d 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -75,6 +75,8 @@ public final class KeyValue implements Comparable<KeyValue> SHARE, ASSIST, AUTOFILL, + DELETE_WORD, + FORWARD_DELETE_WORD, } public static enum Placeholder @@ -707,6 +709,8 @@ public final class KeyValue implements Comparable<KeyValue> case "pasteAsPlainText": return editingKey(0xE035, Editing.PASTE_PLAIN); case "undo": return editingKey(0xE036, Editing.UNDO); case "redo": return editingKey(0xE037, Editing.REDO); + case "delete_word": return editingKey(0xE01B, Editing.DELETE_WORD); + case "forward_delete_word": return editingKey(0xE01C, Editing.FORWARD_DELETE_WORD); case "cursor_left": return sliderKey(Slider.Cursor_left, 1); case "cursor_right": return sliderKey(Slider.Cursor_right, 1); case "cursor_up": return sliderKey(Slider.Cursor_up, 1); diff --git a/srcs/special_font/01B.svg b/srcs/special_font/01B.svg new file mode 100644 index 0000000..cd4d245 --- /dev/null +++ b/srcs/special_font/01B.svg @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Based on materialdesignicons.com backspace-outline --> + +<svg + version="1.1" + width="24" + height="24" + viewBox="0 0 24 24" + id="svg1" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <defs + id="defs1" /> + <path + id="text3" + style="font-weight:600;font-size:13.3333px;font-family:FreeSans;-inkscape-font-specification:'FreeSans Semi-Bold'" + d="m 17.517249,16.883978 c -0.599999,0 -1.199997,0 -1.799996,0 -0.542221,-2.528883 -1.084441,-5.057765 -1.626662,-7.5866476 -0.528888,2.5288826 -1.057775,5.0577646 -1.586663,7.5866476 -0.599998,0 -1.199997,0 -1.799995,0 -0.9155533,-3.239992 -1.8311066,-6.479984 -2.7466599,-9.7199755 0.706665,0 1.4133299,0 2.1199949,0 0.502221,2.4266605 1.004442,4.8533215 1.506663,7.2799815 0.502221,-2.426661 1.004441,-4.853321 1.506662,-7.2799815 0.657776,0 1.315553,0 1.973329,0 0.524443,2.4311048 1.048886,4.8622095 1.573329,7.2933145 0.484443,-2.431105 0.968887,-4.8622097 1.45333,-7.2933145 0.706665,0 1.413329,0 2.119994,0 C 19.3128,10.403994 18.415024,13.643986 17.517249,16.883978 Z M 22,3 c 1.232984,-0.040548 2.168377,1.1810823 2,2.36 -0.0069,4.6147431 0.01374,9.230179 -0.01033,13.844488 C 23.906211,20.390581 22.701093,21.155835 21.58,21 16.677486,20.9972 11.77479,21.0056 6.8723901,20.9958 5.6427252,20.925088 5.1783178,19.667046 4.5442984,18.812248 3.0295323,16.541498 1.5147661,14.270749 0,12 1.8548324,9.2326362 3.6795639,6.4439141 5.5533789,3.6900195 6.2693382,2.7489141 7.4877473,3.0506966 8.5000001,3 13,3 17.5,3 22,3 Z m 0,2 C 17,5 12,5 7,5 5.4266667,7.3333333 3.8533333,9.6666667 2.28,12 c 1.5733333,2.333333 3.1466667,4.666667 4.72,7 5,0 10,0 15,0 0,-4.666667 0,-9.3333333 0,-14 z" /> +</svg> diff --git a/srcs/special_font/01C.svg b/srcs/special_font/01C.svg new file mode 100644 index 0000000..a92bd85 --- /dev/null +++ b/srcs/special_font/01C.svg @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Based on materialdesignicons.com backspace-reverse-outline --> + +<svg + version="1.1" + width="24" + height="24" + viewBox="0 0 24 24" + id="svg1" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <defs + id="defs1" /> + <path + id="text3" + style="font-weight:600;font-size:13.3333px;font-family:FreeSans;-inkscape-font-specification:'FreeSans Semi-Bold'" + d="m 13.559976,16.719975 c -0.599999,0 -1.199997,0 -1.799996,0 -0.542221,-2.528883 -1.084441,-5.057765 -1.626662,-7.586648 -0.5288876,2.528883 -1.0577752,5.057765 -1.5866628,7.586648 -0.5999985,0 -1.1999969,0 -1.7999954,0 -0.9155532,-3.239992 -1.8311065,-6.479984 -2.7466597,-9.7199759 0.7066649,0 1.4133297,0 2.1199946,0 0.502221,2.4266606 1.0044419,4.8533209 1.5066629,7.2799819 0.5022209,-2.426661 1.0044419,-4.8533213 1.5066628,-7.2799819 0.6577762,0 1.3155526,0 1.9733286,0 0.524443,2.431105 1.048886,4.8622099 1.573329,7.2933149 0.484443,-2.431105 0.968887,-4.8622099 1.45333,-7.2933149 0.706665,0 1.413329,0 2.119994,0 -0.897775,3.2399919 -1.795551,6.4799839 -2.693326,9.7199759 z M 2,3 C 0.76701608,2.9594518 -0.16837714,4.1810822 0,5.36 0.00686259,9.9747431 -0.01373935,14.590179 0.01032577,19.204488 0.09378911,20.390581 1.2989069,21.155835 2.42,21 c 4.902514,-0.0028 9.80521,0.0056 14.70761,-0.0042 1.229665,-0.07074 1.694072,-1.328782 2.328092,-2.18358 C 20.970468,16.541498 22.485234,14.270749 24,12 22.145168,9.2326362 20.320436,6.4439141 18.446621,3.6900195 17.730662,2.7489141 16.512253,3.0506966 15.5,3 11,3 6.5,3 2,3 Z m 0,2 c 5,0 10,0 15,0 1.573333,2.3333333 3.146667,4.6666667 4.72,7 C 20.146667,14.333333 18.573333,16.666667 17,19 12,19 7,19 2,19 2,14.333333 2,9.6666667 2,5 Z" /> +</svg> |
