!165 修改inputmethod cash

Merge pull request !165 from mashaoyin/master
This commit is contained in:
openharmony_ci
2022-07-12 11:44:50 +00:00
committed by Gitee
@@ -341,8 +341,9 @@ using namespace MessageID;
void InputMethodController::OnCursorUpdate(CursorInfo cursorInfo)
{
if (!mAgent) {
IMSA_HILOGI("InputMethodController::OnCursorUpdate mAgent is nullptr");
sptr<InputMethodAgentProxy> agent = mAgent;
if (agent == nullptr) {
IMSA_HILOGI("InputMethodController::OnCursorUpdate agent is nullptr");
return;
}
@@ -351,7 +352,7 @@ using namespace MessageID;
return;
}
cursorInfo_ = cursorInfo;
mAgent->OnCursorUpdate(cursorInfo.left, cursorInfo.top, cursorInfo.height);
agent->OnCursorUpdate(cursorInfo.left, cursorInfo.top, cursorInfo.height);
}
void InputMethodController::OnSelectionChange(std::u16string text, int start, int end)
@@ -365,11 +366,12 @@ using namespace MessageID;
mSelectOldEnd = mSelectNewEnd;
mSelectNewBegin = start;
mSelectNewEnd = end;
if (!mAgent) {
IMSA_HILOGI("InputMethodController::OnSelectionChange mAgent is nullptr");
sptr<InputMethodAgentProxy> agent = mAgent;
if (agent == nullptr) {
IMSA_HILOGI("InputMethodController::OnSelectionChange agent is nullptr");
return;
}
mAgent->OnSelectionChange(mTextString, mSelectOldBegin, mSelectOldEnd, mSelectNewBegin, mSelectNewEnd);
agent->OnSelectionChange(mTextString, mSelectOldBegin, mSelectOldEnd, mSelectNewBegin, mSelectNewEnd);
}
void InputMethodController::OnConfigurationChange(Configuration info)
@@ -404,18 +406,19 @@ using namespace MessageID;
bool InputMethodController::dispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> keyEvent)
{
IMSA_HILOGI("InputMethodController::dispatchKeyEvent");
if (!mAgent) {
IMSA_HILOGI("InputMethodController::dispatchKeyEvent mAgent is nullptr");
sptr<InputMethodAgentProxy> agent = mAgent;
if (agent == nullptr) {
IMSA_HILOGI("InputMethodController::dispatchKeyEvent agent is nullptr");
return false;
}
MessageParcel data;
if (!(data.WriteInterfaceToken(mAgent->GetDescriptor())
if (!(data.WriteInterfaceToken(agent->GetDescriptor())
&& data.WriteInt32(keyEvent->GetKeyCode())
&& data.WriteInt32(keyEvent->GetKeyAction()))) {
return false;
}
return mAgent->DispatchKeyEvent(data);
return agent->DispatchKeyEvent(data);
}
int32_t InputMethodController::GetEnterKeyType()
@@ -432,13 +435,13 @@ using namespace MessageID;
void InputMethodController::SetCallingWindow(uint32_t windowId)
{
sptr<InputMethodAgentProxy> agent = mAgent;
IMSA_HILOGI("InputMethodController::SetCallingWindow windowId = %{public}d", windowId);
if (!mAgent) {
IMSA_HILOGI("InputMethodController::SetCallingWindow mAgent is nullptr");
if (agent == nullptr) {
IMSA_HILOGI("InputMethodController::SetCallingWindow agent is nullptr");
return;
}
mAgent->SetCallingWindow(windowId);
return;
agent->SetCallingWindow(windowId);
}
int32_t InputMethodController::SwitchInputMethod(InputMethodProperty *target)