When using Wayland `im-wayland.so` (which is part of libgtk) gets
loaded into the client app instead of `im-ibus.so`. This means that
our ordered output doesn't work with Wayland.
This change works around a problem with keyboards that use multiple
consecutive backspace actions. Because method calls get processed
asynchronously some backspaces get lost. In clients that support
surrounding text we can count the consecutive backspaces and then
do one call to delete surrounding text with the appropriate number
of characters.
This can be tested with "Khmer Angkor" keyboard by typing `xEjmr`,
or with "Vedic Sanskrit Devanagari Phonetic (ITRANS)" keyboard by
typing `shrI`.
Part of #4273.
This change fixes a bug where we the context was wrong after
putting the IP in a new location by mouse-click.
Fixes#8024.
(cherry picked from commit a085fa244b)
- set keyboard options in a call to `km_kbp_state_options_update`
separate from setting the environment options
- output status value if method fails
- if any of the methods fails we now return NULL
- split setting the options in multiple methods
Fixes#7717.
This refactoring makes use of the already defined strings.
It also simplifies setting the values by directly specifying an
UTF-16 string.
Motivated by the changes in PR #7667.
(cherry picked from commit 31340b5b51)
This change makes it possible to compile even when the updated
ibus version is not installed. Of course ordered output won't work
in that case, but at least it will compile and the rest of Keyman
will work.
Fixes#7774.
This reverts commit acab920de8.
I'm confused - now we're getting the same warning again - claiming
that `size_t` is defined as `long unsigned int` and so we have to
use `%lu`!? Is this related to the platform we're compiling on?
This time, the warning we get is when compiling for x86_64:
```
engine.c: In function ‘get_current_context_text’:
engine.c:224:15: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
224 | g_message("%s: current context is:%u:%lu:%s:", __FUNCTION__, km_kbp_context_length(context), buf_size, current_context_utf8);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
engine.c:224:40: note: format string is defined here
224 | g_message("%s: current context is:%u:%lu:%s:", __FUNCTION__, km_kbp_context_length(context), buf_size, current_context_utf8);
| ~^
| |
| unsigned int
| %lu
```
Reverting the previous fix for now.
This refactoring makes use of the already defined strings.
It also simplifies setting the values by directly specifying an
UTF-16 string.
Motivated by the changes in PR #7667.
The previous method name `ibus_keyman_engine_commit_string`
suggests that this method is overridden from ibus-engine class.
However, while it is true that ibus-engine has a
`ibus_engine_commit_string` method it can't be overridden. This
change renames the method to make it clearer that this is an internal
method that won't be called by ibus.
Both `ibus_keyman_engine_reset` and `ibus_keyman_engine_focus_in`
are methods that get called by ibus. Having `ibus_keyman_engine_reset`
call `ibus_keyman_engine_focus_in` makes it much harder to see in
log files which methods get really called by ibus.
This change replaces the call of `...focus_in` with `reset_context`,
which is what `...focus_in` does as well. The only other thing that
`ibus_keyman_engine_focus_in` does in addition to that is calling
`ibus_engine_register_properties` - which shouldn't be necessary on
a reset (besides that we don't seem to do anything with the one
status property we register).
The previous changes didn't work when we output a character +
deadkey. In response to outputting the character we get a
`ibus_keyman_engine_set_surrounding_text` call in which we
called `reset_context` which removed the deadkey marker. This change
fixes this problem by comparing the surrounding text with the
context we already have. Only if it's different we reset the
context.
This change always gets the context from the surrounding text
if `reset_context` gets called. This helps when the user puts the
IP after a certain character. Previously we basically lost the
context, with this change we restore the context so that it's like
the user just typed the previous characters.
We forward a fake event for both keydown and keyup. This change
will set the flag on the fake event so that we get keydown and keyup.
This is probably not technically necessary, but it helps in
debugging because you can then see that both fake events still
belong to the same keypress.
If we're dealing with an older ibus version that doesn't have the
necessary patches we fall back to the old behaviour. Otherwise
we use the new output reordering.