abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Pointers.java
AgeCommit message (Collapse)AuthorFilesLines
2023-08-26Disable automatically Shift when pressing CtrlJules Aguillon1-5/+6
Automatic capitalisation might interferes with keyboard shortcuts.
2023-06-03Per-layout shift modmapJules Aguillon1-0/+4
Specify the behavior of shift for a layout. This is intended for locales that use the same alphabet but have different capital letters (eg. Bengali). The modmap is defined like this: <keyboard> <modmap> <shift a="a" b="A"/> </modmap> </keyboard>
2023-04-10Do not lock modifiers if sliding a keydoak1-0/+1
This unconditionally removes all pointers (touches) pressing modifiers which are not already locked, avoiding that the (currently) latched modifier will be locked aventually. This can be verfified while sliding the space bar to move the cursor left or right. Closes #319.
2023-03-13Correct pointer directionJules Aguillon1-3/+5
The previous algorithm did not cut the circle into 16 equal parts. The division by 2pi yielded numbers smaller than 16, which no longer made sense after the cast to int.
2023-03-05Refactor: Remove KeyboardData.CornerJules Aguillon1-15/+6
The Corner class is removed. The "localized" flag for all the corners is held in a bitfield.
2023-03-03Allow 8 symbols per keyJules Aguillon1-40/+43
'Keyboard.Key' now contains an array of size 9, giving each keyvalue an index. The algorithm for finding the nearest key during a swipe now needs 16 segments, which are now calculated as an angle. The algorithm does one more interation instead of 2 more, slightly reducing the sensitivity of corner values. The 'getAtDirection' function is moved into the Pointers class to clearly separate the two systems. The 'edgekey' attribute is now obsolete but is kept for compatibility. The flag is removed internally, key index are simply translated. Similarly, the 'slider' attribute now act on keys at index 5 and 6 instead of 2 and 3.
2023-03-02Fix caps lock stopped by auto-capitalisationJules Aguillon1-3/+11
Auto-capitalisation triggers when the backspace key is used. Make sure to not remove a locked shift pointer.
2023-02-12Modify keys after a long pressJules Aguillon1-3/+14
2023-02-08Fix arrow keys not repeatingJules Aguillon1-2/+0
The special handling of arrow keys have been removed in 854eff2. Key repeat was not starting when the key0 was empty.
2023-01-29Don't send event at end of slidingJules Aguillon1-0/+13
A sliding pointer going up must not cause a key event to be sent. This caused an extra cursor movement and cleared the latched modifiers.
2023-01-22Move cursor by sliding on the space barJules Aguillon1-3/+62
Send key events for the left or right arrow as the finger slides on the space bar. Can be used to select text by holding shift. Works under Termux. Events are sent linearly as the finger travels. The distance between each events is defined from the swiping distance divided by 4. 'slider="true"' can be set on a key that have 'edgekeys="true"'. 'key2' and 'key3' represent the right and left keys.
2023-01-22Remove the modulated repeatJules Aguillon1-56/+3
It allowed to modulate the repeat speed of some keys (arrow, backspace, delete) by move the finger farther or closer to the key. In practice, this wasn't pratical and doesn't seem popular. It is removed in favor of a better mechanism for moving the cursor.
2022-12-04Correctly handle pointer cancel eventsJules Aguillon1-6/+4
The cancel event ends the motion, it doesn't apply to a single pointer like it was previously expected.
2022-11-26Make fake pointers not lockableJules Aguillon1-3/+3
Especially annoying now that modifiers are not locked by a double tap.
2022-11-06Fix adding two pointers for the same keyJules Aguillon1-1/+2
2022-10-23Add the capslock keyJules Aguillon1-5/+6
The key enable caps lock immediately. It does nothing if caps lock is already enabled. It is not present on the keyboard by default but a place is defined on every layout, top-right of the shift key. It can be enabled in the settings. The icon is from materialdesignicons.com.
2022-07-30Fix auto-capitalisation interfering with caps lockJules Aguillon1-2/+2
Add a flag to recognize fake pointers and avoid clearing the intentionally locked shift key.
2022-07-24Hold any modifier to lockJules Aguillon1-25/+50
Modifiers can be locked with a long press. The key repeat mechanism is re-used and the press timeout is the same. Every modifiers can be locked that way, not only the "lockable" ones. The previous behavior can be enabled in the settings (for shift only) but the default is changed.
2022-07-24Automatic capitalisation at beginning of sentencesJules Aguillon1-2/+23
Keep track of end-of-sentence characters while typing and automatically enable shift when appropriate. The last few characters just before the cursor need to be queried in some cases: Begin of input, cursor has moved or text is deleted. This might have a performance cost. This normally only enable shift but it also needs to disable shift when the cursor moves.
2022-07-03Compatibility with API level < 24Jules Aguillon1-1/+1
The Math.floorMod method was added on API level 24.
2022-06-24Fix localized key not in predefined positionJules Aguillon1-2/+9
The "loc " prefix for predefining a place for an "extra key" was broken since 31d6a70. The FLAG_LOCALIZED flag cannot be used anymore, as adding it to any key would turn it into a different key that wouldn't be recognized by parts of the code comparing the keys (placing the extra keys). Add an other layer in KeyboardData to store such informations.
2022-06-06Refactor: Remove KeyValue.nameJules Aguillon1-6/+3
This makes KeyValue objects smaller. 'equals' and 'hashCode' are now implemented too. Key names are still used to recognise keys with special meaning, but not for comparing keys anymore.
2022-06-05Refactor: Separate Events and Keyevents and use enumsJules Aguillon1-20/+22
Negative values for internal events are preventing further refactoring. Add a new kind of key and split internal events (now Event) and Android's key events (now Keyevent). Use enums events and modifiers outside of the KeyValue class. Internally, they are converted to and from integer.
2022-06-05Refactor: Merge KeyValue.char and code fieldsJules Aguillon1-1/+1
These two fields couldn't have an interesting value at the same time. As we can no longer rely on a special value to distinguish between what's the kind, the kind of the key is explicitly encoded in the two most significative bits of the _flags field. Extra nice thing: This removes the special values 'EVENT_NONE' and 'CHAR_NONE'.
2022-06-05Refactor: Abstract KeyValue fieldsJules Aguillon1-7/+8
The meaning of the public fields of KeyValue was quite complicated and not handled consistently accross the app. Make these fields private and add a more abstract API on top. The meaning of these fields changed recently and it wasn't an easy change. I plan on making more changes in the future.
2022-06-05Stop using flags for modifiersJules Aguillon1-26/+80
There was no free bits left to add new modifiers. Instead of increasing the width of the 'flags' field, refactor the way modifiers are represented and used. Modifers are now represented as independent values and stored in the 'code' field. A flag is added to distinguish between modifiers and keys with a key event. The most notable change is that modifiers can no longer be or-ed into a single value but have to be represented as an array.
2022-05-08Find closest key furtherJules Aguillon1-1/+1
The previous limit was checking d-1 and d+1, the new limit also tries d-2 and d+2.
2022-05-08Fix vibration when pointer move slightlyJules Aguillon1-10/+12
Fix the bug introduced in the parent commit.
2022-05-08Better handling of removed keys and swipe getureJules Aguillon1-13/+35
The "closest key" logic must be careful not to reveal keys removed by a modifier. Must check [_handler.onPointerSwipe] for every candidate values. [selected_value] is changed back to [selected_direction]. This adds a new bug: When the direction change, the selected value might not change but a vibration will be triggered anyway.
2022-05-08Improve nearest key computationJules Aguillon1-3/+3
getAtDirection was too hard to maintain and might contain bugs. Change slightly the meaning of directions and implement a the nearest key calculation as a loop.
2022-05-08only vibrate when the swipe key changesRodrigo Batista de Moraes1-21/+28
2022-05-08use the closest swipe key on swipeRodrigo Batista de Moraes1-13/+16
fix a direction
2022-05-01Fix latched pointers accumulating on the same keyJules Aguillon1-3/+6
It was possible to latch and lock the same modifier several time at the same time independently. Remove that.
2022-04-30Fix modifiers not cleared when presses overlapJules Aguillon1-4/+22
When typing fast, a second key might be pressed before the first is released. Clearing modifiers earlier would prevent this but would break modifiers placed in corners (especially the accent keys). Instead, don't take latched modifiers into account when registering the second press. A new flag is needed to not interfere with holding modifers, which is merged with the norepeat flag.
2022-04-30Record activated modifiers on key downJules Aguillon1-11/+17
The View no longer keeps flags for something other than rendering.
2022-03-19Allow modifiers to hide keysJules Aguillon1-29/+47
Modifiers can temporarily remove a key from the layout by returning 'null'. Make sure pointer handling code handle these modified keys gracefully and doesn't trigger a key event and a vibration for the removed key.
2022-03-17Avoid ghost touches while holding modulated keysJules Aguillon1-0/+15
On some devices, bogus touch events can be sent while holding a key. With modulated keys, it can happens on top of other keys. Ignore every new pointers when a modulated key is pressed.
2022-03-15Handle CANCEL touch eventsJules Aguillon1-0/+10
Handling this event is part of the API but was never done. This caused unstoppable key-repeat. This event isn't common, the only way I found on Android 10 is to switch to the emoji keyboard while holding a key. Some apps might cause this event more often.
2022-03-13Fix crash since 2ea256eJules Aguillon1-1/+1
2022-03-12Fix inconsistent highlighting of lockable keysJules Aguillon1-1/+1
Pointers.getKeyFlags might receive a different KeyValue than what's stored in the pointer due to caching. Compare names instead.
2022-02-22Tweak repeat timing for modulated keysJules Aguillon1-3/+11
Make modulated keys repeat twice as slow by default and start repeating twice as early.
2022-02-21Improve modulated key repeatJules Aguillon1-9/+29
Change the formula: don't use an external constant, add a state. It's now the ratio between where the finger is at the first repeat and where it is now. Keep the repeat going when swiping into an other key. Currently only for arrows: It's now possible to go from an arrow to an other without waiting again for the key repeat timeout. The backspace and delete keys don't work well with this.
2022-02-20Move pointer handling code to its own classJules Aguillon1-0/+262
Separate the concerns and have a clearer interface between the two parts of the code.