commit 7d2d351f5f5a8bc655fd0e943be39150dce9073a Author: Peng Wu Date: Wed Apr 7 11:16:57 2021 +0800 imwayland: relax serial check for some input method Some input method like ibus-m17n will commit text and deliver key event in the same time. As sometimes the event may re-order, the serial number check of wayland input method module will fail. To work around this issue, we relax the serial number check here. diff --git a/modules/input/imwayland.c b/modules/input/imwayland.c index 87c4ae806f..6a3f4f46fb 100644 --- a/modules/input/imwayland.c +++ b/modules/input/imwayland.c @@ -265,7 +265,14 @@ text_input_done (void *data, if (!global->current) return; - valid = serial == global->serial; + /* Some input method like ibus-m17n will commit text and deliver key event + * in the same time. As sometimes the event may re-order, + * wayland input method module may commit_state and increase serial number + * before the "done" event arrives to the input method module, + * then the serial number check will fail. + * To work around this issue, we relax the serial number check here. + */ + valid = serial == global->serial || serial == global->serial - 1; text_input_delete_surrounding_text_apply(global, valid); text_input_commit_apply(global, valid); g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);