mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-19 12:08:05 -04:00
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user