There are some hacks here in the form of an extra field "appears_locked_from", which can be used to hint that the user should see the button as locked. Without it, there's some confusion on user side regarding buttons that change states unprompted.
It didn't make anything more testable due to being tightly coupled to Layout.
With the last place needing the curent form abolished, it's no longer needed.
No attempt to make it more stateless and unit-testable was made though.
If you have a keyboard layout like the following:
A B C D
E F G
H I J K
The E and G keys here should be pressed when clicking in the empty space
next to them. This is achieved by not checking the bounding boxes of
each key and instead just using the button and row offset to extend
buttons/rows to the edges of the view. Caching for the size and
position of rows is introduced to simplify implementation and possibly
improve performance.
Fixes#191
Control and Alt are special in that they aren't expected to switch levels, and so don't need to change what characters are output.
Use in layouts by adding `modifier: Control` or `modifier: Alt` in place of `text: "foo"`.
The latching of the modifier will force the keyboard to emit raw key presses and prevent it from outputting text.
Locking is not determined by button state any more, but rather based on the view active at the moment. If pressing/locking a key results in the current view being active, the key is active. If locking a key results in the current view, the unlock view is activated.
In order to do that, an additional piece of state (layout switcher) was exposed to the event handlers, a separation between squeekboard-only and system layouts was introduced, along with a Translation structure to prevent mixing up strings.
Sizes of widgets can be derived, so storing them was only for C compatibility. Similar with storing position inside of widgets.
Some layout margin and scaling changes could be introduced, meaning a possibility of visual differences.
Moved Cairo context usage to Rust, and rearranged ctx setup (position) to happen in one place.
Removed render calls that were overwritten on each draw call anyway.