Bug 1670731 - Key down event isn't fired during composition when using Wayland IM Module. r=masayuki

Wayland IM module (im-wayland.so, [*1]) doesn't use `gtk_key_snooper_install`,
so snooper mode is different of other IM modules.

*1 https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gtk/gtkimcontextwayland.c

Differential Revision: https://phabricator.services.mozilla.com/D93894
This commit is contained in:
Makoto Kato 2020-10-18 09:46:41 +00:00
parent fd342d7126
commit 179a0134a9
2 changed files with 11 additions and 4 deletions

View File

@ -408,8 +408,7 @@ nsDependentCSubstring IMContextWrapper::GetIMName() const {
// If the context is XIM, actual engine must be specified with
// |XMODIFIERS=@im=foo|.
const char* xmodifiersChar = PR_GetEnv("XMODIFIERS");
if (!xmodifiersChar ||
(!im.EqualsLiteral("xim") && !im.EqualsLiteral("wayland"))) {
if (!xmodifiersChar || !im.EqualsLiteral("xim")) {
return im;
}
@ -504,6 +503,10 @@ void IMContextWrapper::Init() {
mIMContextID = IMContextID::eIIIMF;
mIsIMInAsyncKeyHandlingMode = false;
mIsKeySnooped = false;
} else if (im.EqualsLiteral("wayland")) {
mIMContextID = IMContextID::eWayland;
mIsIMInAsyncKeyHandlingMode = false;
mIsKeySnooped = true;
} else {
mIMContextID = IMContextID::eUnknown;
mIsIMInAsyncKeyHandlingMode = false;
@ -2015,8 +2018,9 @@ bool IMContextWrapper::MaybeDispatchKeyEventAsProcessedByIME(
}
} else {
MOZ_ASSERT(mIsKeySnooped);
// Currently, we support key snooper mode of uim only.
MOZ_ASSERT(mIMContextID == IMContextID::eUim);
// Currently, we support key snooper mode of uim and wayland only.
MOZ_ASSERT(mIMContextID == IMContextID::eUim ||
mIMContextID == IMContextID::eWayland);
// uim sends "preedit_start" signal and "preedit_changed" separately
// at starting composition, "commit" and "preedit_end" separately at
// committing composition.

View File

@ -124,6 +124,7 @@ class IMContextWrapper final : public TextEventDispatcherListener {
eIIIMF,
eScim,
eUim,
eWayland,
eUnknown,
};
@ -139,6 +140,8 @@ class IMContextWrapper final : public TextEventDispatcherListener {
return "eScim";
case IMContextID::eUim:
return "eUim";
case IMContextID::eWayland:
return "eWayland";
default:
return "eUnknown";
}