Commit graph

26 commits

Author SHA1 Message Date
Eberhard Beilharz
d06aa29956
feat(core): implement loading KMX from blob
- split keyboard loading into loading KMX file into blob and then
  loading the keyboard processor from the blob.
- deprecate `km_core_keyboard_load`
- move file access next to deprecated method. This is now the only place
  that loads a file in Core; unit tests have some more places that
  load files.
- introduce GTest and add unit tests for loading from blob

Part-of: #11293
2024-09-24 16:30:39 +02:00
Steven R. Loomis
a455c5b95b fix(core): update core to handle reset context
- updates to debug_api test for rearranged items
- try to rearrange the action queue to match prior behavior

Fixes: #10955
2024-04-05 16:31:23 -05:00
Marc Durdin
9ba919c2a9 fix(core): surrogate handling, markers in app context, and memory leak
Fixes #10615 (surrogate handling, km_core_state_context_set_if_needed).
Fixes #10616 (markers in app context, in unit tests)
Fixes #10617 (memory leak in replace_context).

The surrogate handling and markers in app context bugs were quite
tangled, so opted to fix those both together in one commit. The memory
leak was spotted while verifying the changes for surrogate handling.

Surrogates were not handled in is_context_unchanged, and opted to
refactor to work directly with km_core_context_item arrays rather than
continue with the string-based comparison, for simplicity.

While writing the corresponding unit tests, realised that the
app_context checks were incorrect in a number of existing tests, and so
fixed up the existing tests at the same time as writing up the new
tests. The only changes to core for this were to add assertions for the
app_context to ensure that markers are not inadvertently added.
2024-02-03 09:16:16 +07:00
Marc Durdin
83f80c061a refactor(core): remove unused context APIs
Fixes #10431.

The `km_core_` prefix has been removed from internal-only functions, and
these function declarations moved to context.hpp.

The functions have not been moved from km_core_context_api.cpp at this
stage.

Rewrote the function documentation in Javadoc style comments for the
internal use functions.
2024-01-18 12:18:07 +07:00
Marc Durdin
e5c2525241 refactor(core): split context API from Core primary API
Relates to #9999.
Fixes #10384.

The context API endpoints should no longer be considered as part of the
standard Core API. The only consumers that have a need to access these
APIs are the IMX integration in Engine for Windows, and the Keyman
Developer Debugger.

These symbols are currently used by Developer:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()`
* `km_core_context_set()`
* `km_core_context_clear()`

These symbols are currently used by Windows IMX:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_context_items_dispose()`
* `km_core_context_item_list_size()`
* `km_core_state_get_intermediate_context()`

The following functions and symbols are moving to
keyman_core_api_context.h:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()` function
* `km_core_state_get_intermediate_context()` function
* `km_core_context_set()` function
* `km_core_context_clear()` function
* `km_core_context_get()` function
* `km_core_context_items_from_utf16()` function
* `km_core_context_items_from_utf8()` function
* `km_core_context_items_to_utf8()` function
* `km_core_context_items_to_utf16()` function
* `km_core_context_items_to_utf32()` function
* `km_core_context_items_dispose()` function
* `km_core_context_length()` function
* `km_core_context_append()` function
* `km_core_context_shrink()` function
* `km_core_context_item_list_size()` function
2024-01-16 12:04:41 +07:00
Marc Durdin
bd46fb271b feat(core): unit tests need to set both app context and cached context 2024-01-15 12:34:00 +07:00
Marc Durdin
82177013e9 chore(core): Merge branch 'master' into feat/core/9720-actions-apis 2023-10-24 20:55:10 +07:00
Marc Durdin
0aa86501c6 chore(core): fix types and compile errors
Fixes #9832. Addresses a couple of other cross-platform compile issues.
2023-10-24 09:25:08 +07:00
Eberhard Beilharz
604fbc1a75
chore(linux): Rename namespace kbp to core 2023-10-19 10:39:55 +02:00
Marc Durdin
db76e2541d chore: rename KM_KBP_ to KM_CORE_ 2023-10-09 14:53:22 +07:00
Marc Durdin
ba5f18defd chore: rename km_kbp_ to km_core_ 2023-10-09 14:53:13 +07:00
Marc Durdin
4e5cbc3b96 chore: fix typo 2023-10-09 14:51:51 +07:00
Marc Durdin
4ef18f5e29 chore(core): rename keyboardprocessor.h to keyman_core_api.h
Fixes #9721.

Also tweaks some documentation references to keyboardprocessor, but does
not touch those relating to debian/control.
2023-10-09 14:21:01 +07:00
Marc Durdin
035c447a31 chore(core): move test_assert.h and test_color.h to common 2023-04-10 15:21:45 +07:00
Marc Durdin
4523282510
chore: fix comment
Co-authored-by: Darcy Wong <darcy_wong@sil.org>
2023-03-28 17:58:17 +11:00
Marc Durdin
7a833c8c91 feat(core): use kmc to build kmx tests
Removes the Windows-only kmcomp.exe dependency, and instead now uses
kmc to always build .kmx files for unit tests.

debug_api.cpp was using an outdated .kmx file, which is why the line
number offsets have changed. (The perils of binary fixtures!)
2023-03-24 06:22:40 +07:00
Marc Durdin
c49f0e17ec chore(core): update unit tests with new store indices 2023-03-08 13:47:34 +07:00
Steven R. Loomis
b850e3f7d8 chore(core): ldml: fix merge 🙀
- correct merge issue with km_kbp_process_event()

For feat(developer): ldml: include all LDML data in kmx+ 🙀 #7042
2022-12-16 14:07:08 -06:00
Steven R. Loomis
bc14f18460 Merge remote-tracking branch 'origin/master' into chore/core/mergemaster4-epic-ldml 2022-12-15 17:55:13 -06:00
Marc Durdin
42a9f2ca72 fix(core): emit keystroke was writing to wrong queue
Fixes #7649.

emit_keystroke code path in kmx processor was writing directly to the
core queue instead of to the internal kmx processor queue. This caused
it to be out-of-order in the actions sent to the engine/debugger.

Engines didn't really care but it broke the debugger, for example if
only a deadkey was in the buffer and backspace was pressed, Developer
would assert as it would get unexpected context for the deletions.
2022-11-08 16:31:30 +11:00
Marc Durdin
a8c3854431 fix(core): save() should be on internal kmx action queue
Fixes #7643.

The kmn statement `save()` action was being written directly to the
state queue, bypassing the internal kmx action queue. This caused two
issues:

1. save() actions were out-of-order with other actions on the same key
   event.
2. The number of items in the internal action queue became out of sync
   with the debug item queue, which would cause the debugger to fail
   with an assertion.

The new test in debug_api.cpp validates this second issue as the number
of items in the action queue now matches the expected count in the
corresponding debug item.
2022-11-07 10:28:58 +11:00
Steven R. Loomis
e8dff5cf4e feat(core): add event_flags to process_event #7046
- use a constant, KM_KBP_EVENT_FLAG_DEFAULT for 0
- update pascal and python
- update linux and windows
2022-08-12 09:58:58 -05:00
Steven R. Loomis
21a783a6ca feat(core): add event_flags to process_event
- uint16_t
- defined km_kbp_event_flags to define the bitfield
- bitfield has value KM_KBP_EVENT_FLAG_TOUCH for touch events
- ignored everywhere, currently
2022-08-11 16:14:57 -05:00
Marc Durdin
f762776d5c chore(core): get wasm core building again
Updates search for emscripten if not on path, and fixes up unit test
infrastructure for wasm builds for new tests.
2022-08-01 14:15:52 +10:00
Marc Durdin
d5aa61fdc0 chore(common): Merge branch 'chore/web/keyman-version-for-developer' into chore/common/move-common-core-desktop-to-core 2022-05-30 09:38:27 +10:00
Marc Durdin
a58680f89b chore(common): move common/core/desktop/ to core/ 2022-05-18 07:22:10 +10:00
Renamed from common/core/desktop/tests/unit/kmnkbd/debug_api.cpp (Browse further)