Commit graph

265 commits

Author SHA1 Message Date
Eberhard Beilharz
8e9e957cc0
fix(linux): some refactorings and improvements 2026-04-09 20:37:21 +02:00
Eberhard Beilharz
fc6e2af9c6
Merge branch 'master' into fix/linux/context
Some checks are pending
Keyman Build Summary / Summarize build status checks (push) Waiting to run
2026-04-08 18:30:45 +02:00
Eberhard Beilharz
ad9128eb1d
chore(linux): add comment on purpose of is_dirty flag
Addresses code review comment.
2026-04-08 18:16:08 +02:00
Eberhard Beilharz
b71f299d7e
Update linux/ibus-keyman/src/engine.c
Co-authored-by: Marc Durdin <marc@durdin.net>
2026-04-08 18:08:34 +02:00
Eberhard Beilharz
b765b55660
fix(linux): fix memory problem
This fixes a problem identified by devin.ai: Because of the operator
precedence the previous code caused `memmove` to read
`sizeof(commit_queue_item) - 1` bytes past the end of `commit_queue`.
With this change `memmove` now reads the intended `MAX_QUEUE_SIZE - 1`
`commit_queue_items`.

Test-bot: skip
2026-04-07 15:14:37 +02:00
Eberhard Beilharz
40a0c929d9
fix(linux): fix context after typing Bksp with Wayland
This fixes a problem with the context after typing Backspace when
using Wayland. Wayland uses double-buffering for the text, so we always
have to commit after making changes.

Fixes: #15676
2026-04-07 14:45:22 +02:00
Eberhard Beilharz
6054975438
docs(linux): add clarifying comment about surrounding text 2026-04-01 19:36:09 +02:00
Eberhard Beilharz
69950055e2
fix(linux): fix persisting options
This change adds the verification of the options to the baseline tests
and fixes persisting the options. Previously we treated the UTF-16 key
and value as UTF-8 so that only the first character got persisted.

Test-bot: skip
2025-12-17 19:06:34 +01:00
Eberhard Beilharz
65f2e354eb
maint(linux): suppress output of stopping processes after test run
This change suppresses the output of ending the processes started for
the test run. The output doesn't help much but clutters the overall
output and shows up as warnings on TC.
2025-10-06 16:13:44 +02:00
Eberhard Beilharz
e0d0a4d4c1
maint(linux): fix running integration tests in Docker
Fixes: #13887
Test-bot: skip
2025-09-25 19:32:29 +02:00
Eberhard Beilharz
37e0491b49
refactor(linux): remove a meson deprecation warning
`meson.build_root()` is deprecated in Meson 1.0+.

Test-bot: skip
2025-09-19 18:38:54 +02:00
Eberhard Beilharz
bfc3aa3456
refactor(linux): move dbus defines to common include
This got missed in #14372.

Fixes: #13281
Follow-up-of: #14372
Test-bot: skip
2025-07-25 19:39:50 +02:00
Eberhard Beilharz
d0d774f72c
refactor(linux): move defines to common header files
Fixes: #13281
Test-bot: skip
2025-07-17 19:41:26 +02:00
Eberhard Beilharz
4d81589f48
maint(common): use unique names for Keyman version variables
Previously the builder scripts defined a readonly `VERSION` environment
variable for the Keyman version. That caused problems when another
(external) script tried to define a `VERSION` variable. We encountered
this problem when trying to move the TC build steps of a configuration
into a single script (#13399) when we tried to source `~/.nvm/nvm.sh`.

This change uses a Keyman specific prefix for the version variables and
renames `VERSION` → `KEYMAN_VERSION` etc. Unfortunately these variables
are used in a lot of places, so this turned out to be a bit of a yak
shave.

Test-bot: skip
2025-05-07 18:46:51 +02:00
Marc Durdin
4f829f5c8f chore: Merge remote-tracking branch 'origin/master' into chore/merge-beta-to-master-b18s5 2025-04-21 07:13:35 +07:00
Eberhard Beilharz
6d39ab0b06
Merge pull request #13625 from keymanapp/fix/linux/13590_arrow-keys
fix(linux): allow unhandled keys to pass through to compliant apps

This change fixes a bug introduced in #13372. Before that engine.c determined if keys are handled or not. For keys that we didn't handle we returned FALSE. However, that didn't allow the Core to adjust the context where necessary, so #13372 moved that to Core. However, this caused ibus_keyman_engine_process_key_event to return TRUE even if we didn't handle the key. Instead we called ibus_engine_forward_key_event with the non-handled key. This worked in most applications, but not in the Text Editor.

This change now does no longer call ibus_engine_forward_key_event for compliant apps but instead returns FALSE from ibus_keyman_engine_process_key_event for unhandled keys, allowing the app to see and act on the key event.

An 'unhandled' key here is a key that doesn't match a rule in the keyboard and isn't a character key. Core returns a QIT_EMIT_KEYSTROKE action for that key.

Fixes: #13590
2025-04-03 10:26:27 +02:00
Eberhard Beilharz
659e844f83
docs(linux): add function headers for some of the engine methods 2025-04-01 16:46:18 +02:00
Eberhard Beilharz
ac6b521583
docs(linux): clarify the newly added return values
Addresses code review comments.
2025-04-01 16:44:29 +02:00
Eberhard Beilharz
915d30cd95
fix(linux): fix cursor movement
This change fixes a bug introduced in #13372. Before that `engine.c`
determined if keys are handled or not. For keys that we didn't handle
we returned `FALSE`. However, that didn't allow the Core to adjust the
context where necessary, so #13372 moved that to Core. However, this
caused `ibus_keyman_engine_process_key_event` to return `TRUE` even if
we didn't handle the key. Instead we called `ibus_engine_forward_key_event`
with the non-handled key. This worked in most applications, but not
in the Text Editor.

This change now does no longer call `ibus_engine_forward_key_event` for
compliant apps but instead returns `FALSE` from
`ibus_keyman_engine_process_key_event` for unhandled keys, allowing the
app to see and act on the key event.

Fixes: #13590
2025-03-31 17:58:08 +02:00
Eberhard Beilharz
4a9a3dc55f
refactor(linux): remove a warning
The previous code resulted in warnings showing up:
`(ibus-engine-keyman:4276): GLib-CRITICAL **: 14:31:16.030: g_hash_table_lookup: assertion 'hash_table != NULL' failed`.
This should work around the warning.
2025-03-31 16:33:31 +02:00
Marc Durdin
a52437c407 chore: Merge branch 'master' into chore/b18s4-merge-beta-to-master 2025-03-29 05:38:08 +07: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
74f3a2a975
fix(linux): improve emitting keystrokes
For some reason when using a LDML keyboard we ended up emitting a
keystroke even though Core returned `FALSE for `emitting_keystroke`.
I wasn't able to track down where this happened, but this change seems
like an easy way to fix it.

This showed up when debugging why the changes in #13372 didn't work for
non-compliant apps.
2025-03-21 09:03:21 +01:00
Eberhard Beilharz
42f7142b41
refactor(linux): rename initialize_queue method
The new name `initialize_queue_items` makes it clearer that we initialize
some items in the queue and not the entire queue (which might still
contain items that we do want to keep).
2025-03-20 18:09:34 +01:00
Marc Durdin
f61a104acf
Merge branch 'master' into chore/merge-beta-into-master-B18S2 2025-03-01 15:45:19 +07:00
Eberhard Beilharz
11694db9e3
Merge pull request #13234 from keymanapp/refactor/linux/13204_enable-integration-tests
refactor(linux): re-enable integration tests 🕷️
2025-02-19 11:54:27 +01:00
Eberhard Beilharz
ca96a8c38d
chore(linux): address code review comments 2025-02-19 10:59:44 +01:00
Eberhard Beilharz
366ce9c1fb
Merge pull request #13247 from keymanapp/chore/linux/improve-test-messages
chore(linux): improve output when running tests 🕷️
2025-02-17 17:11:34 +01:00
Eberhard Beilharz
0c2d8f0312
refactor(linux): changes to get integration tests working
This change contains various changes and refactorings which together
allows the integration tests to pass again.

One of the important changs is `DbusTestHelper` which listens to a DBus
signal for a sentinel message and then simulates the sentinel key press.
Getting this to work also requires processing sd-bus messages which hooks
into the glib event loop and is implemented in `EventSource`.

Fixes: #13204
2025-02-14 17:30:42 +01:00
Eberhard Beilharz
af99c1d668
chore(linux): improve the output if dependencies are missing 2025-02-14 16:31:12 +01:00
Marc Durdin
901edd63b9 chore: Revert "chore: Revert "Merge branch 'master' into beta""
This reverts commit d6e7c0b9d1.
2025-02-14 08:44:32 +07:00
Marc Durdin
d6e7c0b9d1 chore: Revert "Merge branch 'master' into beta"
This reverts commit fae3932e15, reversing
changes made to 793daddb48.
2025-02-14 07:45:28 +07:00
Marc Durdin
fae3932e15
Merge branch 'master' into beta 2025-02-13 19:51:57 +07:00
Eberhard Beilharz
f1b32a1439
chore(linux): additional code cleanup after Focal removal 2025-02-12 12:21:49 +01:00
Eberhard Beilharz
ec2373acd5
fix(linux): start system service when switching keyboards
This change fixes #13171 where we failed to output after the first keypress
because the keyman system service had to be started. This change introduces
a new method `Ping` that we call to force keyman-system-service to be
started.

Fixes: #13171
2025-02-10 16:30:20 +01:00
Eberhard Beilharz
4d3d371a88
refactor(linux): fix build failure 2025-02-06 17:03:16 +01:00
Eberhard Beilharz
b1c818338f
refactor(linux): address code review comments 2025-02-06 16:57:52 +01:00
Eberhard Beilharz
ec0ca04805
refactor(linux): Implement ordered output without patched ibus
This change implements things on the ibus-keyman side.

Fixes: #10799
2025-02-05 11:42:05 +01:00
Eberhard Beilharz
80ae8e6289
chore(linux): improve compatibility with Gentoo Linux 🍒
Gentoo doesn't use systemd. `libelogind` or `basu` implement some aspects
of systemd, so we use that on Gentoo (or rather when `libsystemd` is not
available but `libelogind` or `basu` is).

Patch from https://forums.gentoo.org/viewtopic.php?p=8850566.
See also https://community.software.sil.org/t/keyman-for-gentoo-linux/9615.

Cherry-pick-of: #12889
2025-01-29 09:18:22 +01:00
Eberhard Beilharz
248f01f1e3
chore(linux): change SIL International to SIL Global 2024-12-10 10:26:44 +01:00
Eberhard Beilharz
b8c120dd5c
Merge pull request #12721 from keymanapp/chore/core/cherry-pick/load-from-blob-api
feat(core,linux,developer,windows): implement loading KMX from blob 🍒
2024-11-29 12:40:51 +01:00
Eberhard Beilharz
767d7c65be
fix(linux): disable assertions in release builds
This change uses the G_DISABLE_ASSERT flag to disable assertions
for release builds.

See https://docs.gtk.org/glib/func.assert.html
2024-11-27 18:04:35 +01:00
Eberhard Beilharz
8492b12fdb
feat(linux): use new km_core_keyboard_load_from_blob API method
Fixes: #12498
Cherry-pick: #12683
2024-11-27 16:16:36 +01:00
Eberhard Beilharz
4a852c9522
chore(linux): rename test files
This change rename the test files for Linux according to the discussion
at the Keyman conference in November 2024.

Python is pretty opinionated about the naming of files, so we have to
use `*_tests.py` as test filename instead of the usual `*.tests.py`.
2024-11-26 19:06:02 +01:00
Eberhard Beilharz
3169cc0fa5
feat(linux): implement engine side of SimulateAltGr option
- read value from dconf
- set up Core environment
- if dconf value changes re-create the Core environment

Fixes: #7697
2024-06-21 18:27:06 +02:00
Eberhard Beilharz
d93fb6aa0b
refactor(linux): rename methods that deal with keyboard options
This renames the existing methods that read and write keyboard options
so that it's visible from the name that they read/write keyboard options.
This is in preparation of new methods that read and write more general
options.
2024-06-21 18:22:29 +02: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
Eberhard Beilharz
a08fbd1346
fix(linux): Ignore keys with IBUS_MOD4_MASK set
If we process keys that have the (Super/Meta/Windows) IBUS_MOD4_MASK
modifier set we ignore the key. Core doesn't handle the Meta modifier
state and so would treat it as regular key. This fixes switching keyboards
in Ubuntu 23.10/24.04 on Wayland.

Fixes #10476.
2024-02-07 18:14:05 +01:00
Marc Durdin
70ba1d1c1e
Merge branch 'chore/core/10520-hide-old-action-apis' into fix/core/10582-km_core_state_get_actions-idempotency 2024-02-05 13:44:47 +11:00