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.
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.
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'.
Two advantages:
- No need to distinguish modifiers in KeyEventHandler. The KeyValue is
enough to decide what action to do.
- Keys are never a Char and Event at the same time, fields can be
merged.
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.
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.
Requires two new diacritics: ogonek and dot_above.
The new accents are also added to the Latvian layout as the two language
can be close but not to the other localized layouts. A new mechanism is
needed to reproducibly add extra keys to layouts without manual
placement.
KeyValue defines an ADT and some of its values, it now contains public
final fields and no internal logic.
KeyModifier handles modifiers and accents and creates new instances of
KeyValue when needed.
This operation is now properly cached.