Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>

Changes to be committed:
This commit is contained in:
ma-shaoyin 2023-01-11 11:03:45 +08:00
parent 7656b27db3
commit 0f9f07aec2
3 changed files with 40 additions and 0 deletions

View File

@ -555,6 +555,10 @@ void JsInputMethodEngineSetting::OnInputStart()
return;
}
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value textInput = JsTextInputClientEngine::GetTextInputClientInstance(item->env_);
napi_value keyBoardController = JsKeyboardControllerEngine::GetKeyboardControllerInstance(item->env_);
if (keyBoardController == nullptr || textInput == nullptr) {
@ -597,6 +601,10 @@ void JsInputMethodEngineSetting::OnKeyboardStatus(bool isShow)
});
for (auto &item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value callback = nullptr;
napi_value args[ARGC_ONE] = { nullptr };
napi_get_reference_value(item->env_, item->callback_, &callback);
@ -637,6 +645,10 @@ void JsInputMethodEngineSetting::OnInputStop(const std::string &imeId)
}
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value args[ARGC_ONE] = { nullptr };
napi_create_string_utf8(item->env_, entry->imeid.c_str(), NAPI_AUTO_LENGTH, &args[0]);
@ -679,6 +691,10 @@ void JsInputMethodEngineSetting::OnSetCallingWindow(uint32_t windowId)
}
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value args[ARGC_ONE] = { nullptr };
napi_create_int32(item->env_, entry->windowid, &args[0]);
@ -721,6 +737,10 @@ void JsInputMethodEngineSetting::OnSetSubtype(const SubProperty &property)
}
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value jsObject = GetResultOnSetSubtype(item->env_, entry->subProperty);
if (jsObject == nullptr) {
IMSA_HILOGE("get GetResultOnSetSubtype failed: jsObject is nullptr");

View File

@ -373,6 +373,10 @@ bool JsKeyboardDelegateSetting::OnKeyEvent(int32_t keyCode, int32_t keyStatus)
});
bool isOnKeyEvent = false;
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value jsObject =
GetResultOnKeyEvent(item->env_, entry->keyEventPara.keyCode, entry->keyEventPara.keyStatus);
if (jsObject == nullptr) {
@ -541,6 +545,10 @@ void JsKeyboardDelegateSetting::OnCursorUpdate(int32_t positionX, int32_t positi
});
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value args[ARGC_THREE] = { nullptr };
napi_create_int32(item->env_, entry->curPara.positionX, &args[ARGC_ZERO]);
napi_create_int32(item->env_, entry->curPara.positionY, &args[ARGC_ONE]);
@ -582,6 +590,10 @@ void JsKeyboardDelegateSetting::OnSelectionChange(int32_t oldBegin, int32_t oldE
});
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value args[ARGC_FOUR] = { nullptr };
napi_create_int32(item->env_, entry->selPara.oldBegin, &args[ARGC_ZERO]);
napi_create_int32(item->env_, entry->selPara.oldEnd, &args[ARGC_ONE]);
@ -623,6 +635,10 @@ void JsKeyboardDelegateSetting::OnTextChange(const std::string &text)
});
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value args[ARGC_ONE] = { nullptr };
napi_create_string_utf8(item->env_, entry->text.c_str(), NAPI_AUTO_LENGTH, &args[ARGC_ZERO]);

View File

@ -591,6 +591,10 @@ void JsGetInputMethodSetting::OnImeChange(const Property &property, const SubPro
return;
}
for (auto item : entry->vecCopy) {
if (item->threadId_ != std::this_thread::get_id()) {
IMSA_HILOGD("differ threadId.");
continue;
}
napi_value subProperty = JsInputMethod::GetJsInputMethodSubProperty(item->env_, entry->subProperty);
napi_value property = JsInputMethod::GetJsInputMethodProperty(item->env_, entry->property);
if (subProperty == nullptr || property == nullptr) {