Skip to content

Commit

Permalink
src/ibusenginesimple.c: Don't commit any characters
Browse files Browse the repository at this point in the history
Revert a part of the previous patch of #2495 because it explains
"Super-space and space key can launch IBus Emojier." but I cannot
remember what I tried to fix.

IBus XKB engines should not commit any keysyms before the key event is
sent to the application with IBUS_IGNORED_MASK flag even if the key
is not an ASCII because any characters can be control characters
by application.
E.g. VIM cursor mode "hjkl" keys or game cursor keys with language
layouts.

Fixes: ad883dc

BUG=#2588
  • Loading branch information
fujiwarat committed Dec 20, 2023
1 parent 8470873 commit 4872c1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions client/gtk2/ibusimcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ ibus_im_context_commit_event (IBusIMContext *ibusimcontext,
keyval == GDK_KEY_KP_Enter) {
return FALSE;
}
/* #2588 If IBus tries to commit a character, it should be forwarded to
* the application at once with IBUS_IGNORED_MASK before the actual
* commit because any characters can be control characters even if
* they are not ASCII characters, e.g. game cursor keys with a
* language keyboard layout likes VIM cursor mode "hjkl" keys.
*/
ch = ibus_keyval_to_unicode (keyval);
if (ch != 0 && !g_unichar_iscntrl (ch)) {
IBusText *text = ibus_text_new_from_unichar (ch);
Expand Down
15 changes: 10 additions & 5 deletions src/ibusenginesimple.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,17 @@ no_sequence_matches (IBusEngineSimple *simple,

ibus_engine_simple_update_preedit_text (simple);
ch = ibus_keyval_to_unicode (keyval);
/* IBUS_CHANGE: RH#769133
* Since we use ibus xkb engines as the disable state,
* Super-space and space key can launch IBus Emojier.
/* IBUS_CHANGE: RH#769133, #2588
* Since we use ibus xkb engines as the disable IM mode,
* do not commit the characters locally without in_hex_sequence.
* If IBus tries to commit a character, it should be forwarded to
* the application at once with IBUS_IGNORED_MASK before the actual
* commit because any characters can be control characters even if
* they are not ASCII characters, e.g. game cursor keys with a
* language keyboard layout likes VIM cursor mode "hjkl" keys.
*/
if (ch != 0 && !g_unichar_iscntrl (ch) && ch > 0x7F) {
ibus_engine_simple_commit_char (simple, ch);
if (ch != 0 && !g_unichar_iscntrl (ch) &&
priv->in_hex_sequence) {
return TRUE;
} else {
return FALSE;
Expand Down

0 comments on commit 4872c1f

Please sign in to comment.