Commit graph

84 commits

Author SHA1 Message Date
Marc Durdin
70c54b0b40 chore: Merge branch 'epic/web-core' into auto/A19S24-merge-master-into-web-core
Some checks are pending
Keyman Build Summary / Summarize build status checks (push) Waiting to run
2026-03-16 04:49:38 +01:00
Eberhard Beilharz
f07f95452f
docs(core): add keyhandling doc
This documents the state of `km_core_actions.emit_keystroke` for
different keys pressed. Also some cleanup in other docs.

This documents the state after merging #15609 (for ldml keyboards) and
NN (for kmn keyboards).

Follows: #15609
Build-bot: skip
Test-bot: skip
2026-02-25 19:31:00 +01:00
Eberhard Beilharz
0422b3f912
chore(core): Remove km_core_keyboard_attrs.folder_path
PR #12769 removed `km_core_keyboard_load` that allowed loading a keyboard
from a path. Instead we now pass a BLOB to core to load a keyboard.
With the function gone there is no longer a need to have a field with the
path.

Follow-up-of: #12497
Related-to: #12769
Test-bot: skip
2026-01-20 15:17:38 +01:00
Eberhard Beilharz
a7083e7960
feat(web): move/add core-adapter module
This change moves the core adapter to core-adapter module which contains
the code to bind to the the WASM core binaries and adds additional type
definitions for Core.

Part-of: #13926
Test-bot: skip
2025-11-14 15:10:20 +01:00
Marc Durdin
7c42887ead
Merge branch 'epic/web-core' into chore/merge-master-into-web-core 2025-03-31 12:13:48 +07:00
Eberhard Beilharz
1f8f979f61
Update core/include/keyman/keyman_core_api_vkeys.h
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-03-27 15:39:00 +01:00
Eberhard Beilharz
3e3a0dbce1
refactor(linux): mark undocumented keycodes as internal
Several keys that are defined in `winuser.h` were added after Keyman
defined its vkeys and so are not documented in the Keyman docs. This
change adds underscores before and after to mark them as being internal.
It's still useful to have them in the source code because it makes the
mapping between Linux keys and Keyman vkeys easier.

Addresses code review comment.
2025-03-26 16:49:31 +01:00
Eberhard Beilharz
a645fea903
fix(linux): improve key mapping to allow Core to reset context
This change tries to map all keys to corresponding Core VKeys so that
Core sees them and can reset the context if necessary. Previously we
had 0 for most of the keys, which meant that we didn't send them to
Core but instead returned right away. While this doesn't directly fix
the failing user tests described in #12968, it fixes the original tests
in #11172.

Closes: #12968
2025-03-21 18:15:46 +01:00
Eberhard Beilharz
b2cccdd996
feat(core): expose context and actions APIs to WASM 2025-03-03 11:29:17 +01:00
Eberhard Beilharz
c297c66a64
feat(core): expose state and event API to WASM 2025-03-03 11:28:57 +01:00
Joshua Horton
0d0c339f67
Merge branch 'epic/web-core' into chore/merge-master-into-web-core 2025-01-17 11:37:51 +07:00
Eberhard Beilharz
2e5722705b
feat(web): address code review comments 2025-01-06 15:12:09 +01:00
Eberhard Beilharz
a072171ec8
feat(web): load .kmx keyboard from blob
This change adds the web side of loading a .kmx keyboard from a
blob. It also replaces the `CoreProcessor` class with `CoreFactory`
that allows to directly use the methods defined in WASM without
having to add another wrapper for each method.
2024-12-20 18:01:42 +01:00
Eberhard Beilharz
1bedc62b57
feat(core): expose km_core_keyboard_load_from_blob to WASM 2024-12-09 16:06:31 +01:00
Steven R. Loomis
de3397b476
Merge pull request #12644 from keymanapp/fix/core/12298-get-key-list
fix(core): implement ldml_processor::get_key_list() 🙀
2024-12-09 08:14:44 -06:00
Marc Durdin
4c3b2132ee chore(core): remove km_core_keyboard_load API
Fixes: #12497
2024-12-04 13:38:07 +07:00
Steven R. Loomis
7f3bd30961 feat(core): improvements for get_key_list()
- expand OTHER and ALT / CTRL appropriately
- add KM_CORE_MODIFIER_NONE=0
- disable test of get_key_list() for now

Fixes: #12298
2024-11-29 17:25:31 -06:00
Eberhard Beilharz
3dc3f040de
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

Cherry-picked from `epic/web-core` branch.

Cherry-Pick-Commit: 1deaa323ad
Cherry-Pick-Commit: 59019cc8b7
Cherry-Pick-Commit: bc46458368
Cherry-Pick-Commit: d06aa29956
Cherry-Pick-Commit: 1c88166f6e
Cherry-Pick-Commit: 069cd21ecd
Cherry-Pick-Commit: 052ae2ec35
Cherry-Pick-Commit: 11a2a3ba3a

Part-of: #11293
Part-of: #8093
2024-11-27 15:30:05 +01:00
Steven R. Loomis
6706ae0957 chore(core): km_core_cp -> km_core_cu
- km_core_cp represents a 16 bit code unit, not a code point.

Fixes: #11033
2024-05-02 17:39:15 -05:00
Marc Durdin
7f7bbe5030
chore: Apply suggestions from code review
Co-authored-by: rc-swag <58423624+rc-swag@users.noreply.github.com>
2024-03-22 17:31:28 +11:00
Marc Durdin
7136a69ac8 chore(core): fix links and tweaks docs 2024-03-21 06:12:59 +07:00
Marc Durdin
7bfda9881f chore(core): fix typos 2024-03-20 13:30:05 +07:00
Marc Durdin
216d4afdef chore(core): fix typos 2024-03-20 13:09:09 +07:00
Marc Durdin
56e70b82d1 chore(core): add links to other markdown files for v17 2024-03-20 13:08:24 +07:00
Marc Durdin
f43d5aa53f chore: copy change docs into header as well 2024-03-20 12:58:42 +07:00
Marc Durdin
73daec43c1 chore(core): refresh documentation and add build tool
Refreshes all of the public API header documentation so we have a single
source for the documentation -- the keyman_core_api.h header. A lot of
reformatting but very little change in terms of content.

This is converted into Markdown by api-header-extractor, and the results
can be copied to help.keyman.com.

Will only do the main keyman_core_api.h for v17 release, in interests of
time. The other headers are primarily internal only and have many
deprecated functions also.

Will also leave the full automation of the documentation generation to a
future PR. The script will be there but it won't run during build for
now.
2024-03-20 12:56:08 +07:00
Marc Durdin
83ac78ab7c chore(core): refresh API docs for 17.0
Fixes #10580.
2024-03-13 09:23:07 -05:00
Marc Durdin
1b88ab99be fix(core): make km_core_state_get_actions() idempotent
Fixes #10582.

Returned struct from the `km_core_state_get_actions()` API is now owned
by the state object. This is a change in API contract. The corresponding
`km_core_actions_dispose()` API has been made private, because there is
never any need for API consumers to call it. As this change is happening
in alpha, we won't bump the ABI version.

`state->app_context` is now guaranteed to be in sync with
`state->context` after `km_core_process_event()`, with the actions
struct populated at that point.

The next and final step in this refactor is to remove the actions queue
altogether from the Core and make that a kmn-only concept, but that will
wait until 18.0. The only consumers of the actions queue are the
kmn-specific interactive debugger in Keyman Developer, and kmn-specific
Input Method eXtensions in Keyman Engine for Windows.
2024-02-01 11:28:08 +07:00
Marc Durdin
9ee5777e48 chore(core): move action apis into keyman_core_api_actions.h
Fixes #10520.

The definitions for `struct km_core_action_item`, `struct
km_core_backspace_item`, `enum km_core_backspace_type`, `enum
km_core_action_type`, `km_core_state_action_items()`,
`km_core_state_queue_action_items()`, `km_core_process_queued_actions()`
are now in keyman_core_api_actions.h rather than in the primary
keyman_core_api.h, as they should not be used by engines in general.

The current users of those APIs are the interactive kmx debugger, and
the IMX integration in Keyman Engine for Windows. Both of these depend
on the old action queue model rather than the actions struct.

In a future version, we may refactor these further to make them apply
directly to the KMX processor, and provide access via an interface to
the KMX processor rather than as a general Core API. Once this change is
made, then Core itself will no longer support action queues at all, and
will expect keyboard processors to fill in an action struct (this is
already done for LDML).
2024-01-31 11:32:09 +07:00
Marc Durdin
868247e9fe chore(core): address review comments 2024-01-30 07:36:52 +07:00
Marc Durdin
8501f2aa6d feat(core): add deleted_context to km_core_actions struct
Fixes #10530.

Adds the deleted_context member to the km_core_actions struct, and
associated unit tests. Simplifies integration by providing the consumer
with all the data they need in order to execute the transform,
specifically around number of delete operations required, without
needing to query the target application context again. The number of
delete operations will vary according to application compliance and
selected encoding; for example a UTF-16 string may require 2
delete-backs for surrogate pairs in the text buffer for a compliant app,
whereas there will be a single delete-back key event for a non-compliant
app.

The deleted_context member should also be used for debug assertions.
2024-01-29 13:21:25 +07:00
Marc Durdin
41cc2f4d1e feat(developer): make context_get and context_length public again
Rolls back the privatisation of the km_core_context_get and
km_core_context_length APIs because the debugger uses them.
2024-01-26 06:37:09 +07:00
Marc Durdin
4906545e31
Merge branch 'epic/core/9999-normalization' into refactor/core/10431-remove-unused-core-context-apis 2024-01-24 12:14:11 +11:00
Steven R. Loomis
6ea83391a7 Merge remote-tracking branch 'origin/epic/core/9999-normalization' into feat/core/10410-ldml-really-use-action-struct 2024-01-19 10:40:42 -06:00
Marc Durdin
4f909dcc83
Merge pull request #10403 from keymanapp/feat/core/9999-normalize-output
feat(core): infrastructure for normalization of output 🌱
2024-01-19 13:51:00 +11:00
Marc Durdin
a26e21aba7 chore(core): address review comments 2024-01-19 08:01:45 +07:00
Steven R. Loomis
4c322ddb8a feat(core): ldml action struct 🌱
- update km_core_actions.output to be a const*
- for now, call state->actions().commit() from ldml_event_state::commit()

For: #10410
2024-01-18 22:26:46 -06: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
c6acf86629
Merge pull request #10419 from keymanapp/chore/core/10410-ldml-just-say-no-to-action-queues
chore(core): ldml assert if queue functions are called 🌱
2024-01-18 14:47:04 +11:00
Marc Durdin
eece9716b7 refactor(core): additional comments 2024-01-18 10:42:18 +07:00
Steven R. Loomis
f484615450 chore(core): ldml don't use queue action functions 🌱 2024-01-17 16:16:56 -06:00
Marc Durdin
671973baab 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-17 14:44:25 +11:00
Marc Durdin
e39affe93b feat(core): infrastructure for normalization of output
Relates to #9999.

Establishes functions, unit test sources, normalization entry point and
an effectively no-op unit test for normalization support.
2024-01-16 13:46:46 +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
cd69405960 feat(core): add app_context and failing tests
Adds the application context member of state and a corresponding,
failing unit test, which starts the process of verifying the handling
of the application context.
2024-01-15 11:50:15 +07:00
Marc Durdin
32ee4bc386 fix(core): typedef enum 2024-01-15 08:00:32 +07:00
Marc Durdin
bfb26eaf64 feat(core): adds km_core_state_context_debug
Fixes #10365.

Adds a `km_core_state_context_debug` function that returns a km_core_cp
string containing the current cached or intermediate context. The
function must be used only for debug logging purposes -- the string is
not intended to parsed for other purposes and the format may change in
the future.

This commit adds the function and corresponding unit tests. Subsequent
commits will update existing context debug functions in various engines
to use this API endpoint instead.
2024-01-15 07:19:31 +07:00
Eberhard Beilharz
9b768c57d7
refactor(linux): Use km_core_state_context_set_if_needed
Also update comment on `km_core_state_context_set_if_needed` to make it
clearer that it's expecting a UTF-16 string.

Closes #10212.
2024-01-10 18:57:41 +01:00
Marc Durdin
b6daac0bdb feat(core): action struct to action items conversion
Adds state->set_actions(). This sets the Core's action list to match the
contents of the action struct. Note that markers are not supported and
backspace expected_values will be empty, as this information is not
available. As the intended consumer of the action struct does not need
to know this information, this should be adequate.
2023-12-01 12:27:49 +07:00
Marc Durdin
8475b68248 feat(core): make persist_options always point to a valid array 2023-10-25 05:46:43 +07:00