Reduce key dictionary memory footprint

Instead of indexing `Key` objects that have multiple names by each
individual name, index by the set of names. This reduces the size of the
default key dictionary by a factor of between 2 and 3, and as result
also reduces reallocations/defragmentation.
Instead of instantiating all module/extension keys by default, append
them to the `maybe_key`-generator list.
This commit is contained in:
xs5871
2022-12-05 19:54:57 +00:00
parent 47c242a2c9
commit 9c1bd210eb
27 changed files with 439 additions and 434 deletions

View File

@@ -35,7 +35,7 @@ def simple_key_sequence(seq):
meta=KeySequenceMeta(seq),
on_press=sequence_press_handler,
on_release=passthrough,
)
)[0]
def send_string(message):
@@ -124,7 +124,7 @@ def unicode_codepoint_sequence(codepoints):
simple_key_sequence(_winc_unicode_sequence(kc_macros, keyboard)), True
)
return make_key(on_press=_unicode_sequence)
return make_key(on_press=_unicode_sequence)[0]
def _ralt_unicode_sequence(kc_macros, keyboard):