mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-05-13 06:41:12 +00:00
fix name error
Signed-off-by: 张凯 <zhangkai324@huawei.com> Change-Id: I9e0965ee34ac53f10d8b6948e995f72886b4c583
This commit is contained in:
parent
9e2aedff61
commit
7cb0c0e8db
@ -2977,7 +2977,7 @@ public:
|
||||
/**
|
||||
* @brief Show keyboard window
|
||||
*
|
||||
* @param mode keyboard will shown with special mode.
|
||||
* @param mode Keyboard will show with special mode.
|
||||
* @return WM_OK means window show success, others means failed.
|
||||
*/
|
||||
virtual WMError ShowKeyboard(KeyboardViewMode mode)
|
||||
@ -2986,9 +2986,9 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief change keyboard view mode
|
||||
* @brief Change keyboard view mode
|
||||
*
|
||||
* @param mode keyboard will update to the special mode.
|
||||
* @param mode Keyboard will update to the special mode.
|
||||
* @return WM_OK means view mode update success, others means failed.
|
||||
*/
|
||||
virtual WMError ChangeKeyboardViewMode(KeyboardViewMode mode)
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
void TearDown() override;
|
||||
|
||||
private:
|
||||
static constexpr uint32_t SPLIT_TEST_SLEEP_S = 1;
|
||||
static constexpr uint32_t TEST_SLEEP_SECOND = 1;
|
||||
static constexpr uint32_t WAIT_SYNC_IN_NS = 200000;
|
||||
};
|
||||
|
||||
@ -79,21 +79,21 @@ HWTEST_F(WindowInputMethodTest, ShowKeyboard01, Function | MediumTest | Level3)
|
||||
return;
|
||||
}
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->ShowKeyboard(KeyboardViewMode::DARK_IMMERSIVE_MODE));
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
sleep(TEST_SLEEP_SECOND);
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->ChangeKeyboardViewMode(KeyboardViewMode::LIGHT_IMMERSIVE_MODE));
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
sleep(TEST_SLEEP_SECOND);
|
||||
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_PARAM,
|
||||
fullWindow->ChangeKeyboardViewMode(static_cast<KeyboardViewMode>(-1)));
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
sleep(TEST_SLEEP_SECOND);
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
sleep(TEST_SLEEP_SECOND);
|
||||
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW,
|
||||
fullWindow->ChangeKeyboardViewMode(KeyboardViewMode::DARK_IMMERSIVE_MODE));
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
sleep(TEST_SLEEP_SECOND);
|
||||
fullWindow->Destroy();
|
||||
}
|
||||
} // namespace
|
||||
|
@ -87,7 +87,7 @@ const std::string SET_SUPPORT_WINDOW_MODES_CB = "setSupportWindowModes";
|
||||
const std::string SESSION_LOCK_STATE_CHANGE_CB = "sessionLockStateChange";
|
||||
const std::string UPDATE_SESSION_LABEL_AND_ICON_CB = "updateSessionLabelAndIcon";
|
||||
const std::string KEYBOARD_STATE_CHANGE_CB = "keyboardStateChange";
|
||||
const std::string KEYBOARD_VIEW_MODE_CHANGE_CB = "KeyboardViewModeChange";
|
||||
const std::string KEYBOARD_VIEW_MODE_CHANGE_CB = "keyboardViewModeChange";
|
||||
const std::string SET_WINDOW_CORNER_RADIUS_CB = "setWindowCornerRadius";
|
||||
|
||||
constexpr int ARG_COUNT_3 = 3;
|
||||
@ -5956,8 +5956,8 @@ void JsSceneSession::ProcessKeyboardStateChangeRegister()
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "session is nullptr, id:%{public}d", persistentId_);
|
||||
return;
|
||||
}
|
||||
session->SetKeybaordStateChangeListener(
|
||||
[weakThis = wptr(this), where = __func__](const SessionState& state, const KeyboardViewMode& mode) {
|
||||
session->SetKeyboardStateChangeListener(
|
||||
[weakThis = wptr(this), where = __func__](SessionState state, KeyboardViewMode mode) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGNE(WmsLogTag::WMS_KEYBOARD, "%{public}s jsSceneSession is null", where);
|
||||
@ -5968,7 +5968,7 @@ void JsSceneSession::ProcessKeyboardStateChangeRegister()
|
||||
TLOGD(WmsLogTag::WMS_KEYBOARD, "success");
|
||||
}
|
||||
|
||||
void JsSceneSession::OnKeyboardStateChange(const SessionState& state, const KeyboardViewMode& mode)
|
||||
void JsSceneSession::OnKeyboardStateChange(SessionState state, KeyboardViewMode mode)
|
||||
{
|
||||
auto session = weakSession_.promote();
|
||||
if (session == nullptr) {
|
||||
@ -5976,7 +5976,7 @@ void JsSceneSession::OnKeyboardStateChange(const SessionState& state, const Keyb
|
||||
return;
|
||||
}
|
||||
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "id: %{public}d, state: %{public}d, KeyboardViewMode: %{public}d",
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "id: %{public}d, state: %{public}d, KeyboardViewMode: %{public}u",
|
||||
session->GetPersistentId(), state, static_cast<uint32_t>(mode));
|
||||
auto task = [weakThis = wptr(this), persistentId = persistentId_, state, env = env_, mode] {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
@ -5991,11 +5991,12 @@ void JsSceneSession::OnKeyboardStateChange(const SessionState& state, const Keyb
|
||||
return;
|
||||
}
|
||||
napi_value jsKeyboardStateObj = CreateJsValue(env, state);
|
||||
napi_value jskeyboardViewModeObj = CreateJsValue(env, mode);
|
||||
napi_value argv[] = { jsKeyboardStateObj, jskeyboardViewModeObj };
|
||||
napi_value jsKeyboardViewModeObj = CreateJsValue(env, mode);
|
||||
napi_value argv[] = { jsKeyboardStateObj, jsKeyboardViewModeObj };
|
||||
napi_call_function(env, NapiGetUndefined(env), jsCallBack->GetNapiValue(), ArraySize(argv), argv, nullptr);
|
||||
};
|
||||
taskScheduler_->PostMainThreadTask(task, "OnKeyboardStateChange, state:" + std::to_string(static_cast<int>(state)));
|
||||
taskScheduler_->PostMainThreadTask(task, "OnKeyboardStateChange, state:" +
|
||||
std::to_string(static_cast<uint32_t>(state)));
|
||||
}
|
||||
|
||||
void JsSceneSession::ProcessKeyboardViewModeChangeRegister()
|
||||
@ -6017,9 +6018,9 @@ void JsSceneSession::ProcessKeyboardViewModeChangeRegister()
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Register success. id: %{public}d", persistentId_);
|
||||
}
|
||||
|
||||
void JsSceneSession::OnKeyboardViewModeChange(const KeyboardViewMode& mode)
|
||||
void JsSceneSession::OnKeyboardViewModeChange(KeyboardViewMode mode)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Change KeyboardViewMode to %{public}d.", static_cast<uint32_t>(mode));
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Change KeyboardViewMode to %{public}u", static_cast<uint32_t>(mode));
|
||||
auto task = [weakThis = wptr(this), persistentId = persistentId_, env = env_, mode] {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession || jsSceneSessionMap_.find(persistentId) == jsSceneSessionMap_.end()) {
|
||||
@ -6036,7 +6037,7 @@ void JsSceneSession::OnKeyboardViewModeChange(const KeyboardViewMode& mode)
|
||||
napi_value argv[] = {jsKeyboardViewMode};
|
||||
napi_call_function(env, NapiGetUndefined(env), jsCallBack->GetNapiValue(), ArraySize(argv), argv, nullptr);
|
||||
};
|
||||
taskScheduler_->PostMainThreadTask(task, "OnKeyboardViewModeChange");
|
||||
taskScheduler_->PostMainThreadTask(task, __func__);
|
||||
}
|
||||
|
||||
void JsSceneSession::ProcessSetWindowCornerRadiusRegister()
|
||||
|
@ -388,8 +388,8 @@ private:
|
||||
void OnUpdateAppUseControl(ControlAppType type, bool isNeedControl);
|
||||
void OnWindowMoving(DisplayId displayId, int32_t pointerX, int32_t pointerY);
|
||||
void UpdateSessionLabelAndIcon(const std::string& label, const std::shared_ptr<Media::PixelMap>& icon);
|
||||
void OnKeyboardStateChange(const SessionState& state, const KeyboardViewMode& mode);
|
||||
void OnKeyboardViewModeChange(const KeyboardViewMode& mode);
|
||||
void OnKeyboardStateChange(SessionState state, KeyboardViewMode mode);
|
||||
void OnKeyboardViewModeChange(KeyboardViewMode mode);
|
||||
|
||||
/*
|
||||
* Window Property
|
||||
|
@ -1572,7 +1572,7 @@ napi_value KeyboardGravityInit(napi_env env)
|
||||
|
||||
napi_value KeyboardViewModeInit(napi_env env)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "KeyboardViewModeInit");
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "In");
|
||||
if (env == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "Env is nullptr");
|
||||
return nullptr;
|
||||
|
@ -94,7 +94,7 @@ using RequestVsyncFunc = std::function<void(const std::shared_ptr<VsyncCallback>
|
||||
using NotifyWindowMovingFunc = std::function<void(DisplayId displayId, int32_t pointerX, int32_t pointerY)>;
|
||||
using NofitySessionLabelAndIconUpdatedFunc =
|
||||
std::function<void(const std::string& label, const std::shared_ptr<Media::PixelMap>& icon)>;
|
||||
using NotifyKeyboardStateChangeFunc = std::function<void(const SessionState& state, const KeyboardViewMode& mode)>;
|
||||
using NotifyKeyboardStateChangeFunc = std::function<void(SessionState state, KeyboardViewMode mode)>;
|
||||
|
||||
class ILifecycleListener {
|
||||
public:
|
||||
@ -410,7 +410,7 @@ public:
|
||||
* Keyboard Window
|
||||
*/
|
||||
bool CheckEmptyKeyboardAvoidAreaIfNeeded() const;
|
||||
void SetKeybaordStateChangeListener(const NotifyKeyboardStateChangeFunc& func);
|
||||
void SetKeyboardStateChangeListener(const NotifyKeyboardStateChangeFunc& func);
|
||||
|
||||
bool IsSessionValid() const;
|
||||
bool IsActive() const;
|
||||
|
@ -83,7 +83,7 @@ WSError KeyboardSession::Show(sptr<WindowSessionProperty> property)
|
||||
session->GetSessionProperty()->SetKeyboardViewMode(property->GetKeyboardViewMode());
|
||||
session->UseFocusIdIfCallingSessionIdInvalid();
|
||||
TLOGNI(WmsLogTag::WMS_KEYBOARD,
|
||||
"Show keyboard session, id: %{public}d, calling id: %{public}d, viewMode: %{public}d",
|
||||
"Show keyboard session, id: %{public}d, calling id: %{public}d, viewMode: %{public}u",
|
||||
session->GetPersistentId(), session->GetCallingSessionId(),
|
||||
static_cast<uint32_t>(property->GetKeyboardViewMode()));
|
||||
session->MoveAndResizeKeyboard(property->GetKeyboardLayoutParams(), property, true);
|
||||
|
@ -3149,13 +3149,27 @@ bool Session::CheckEmptyKeyboardAvoidAreaIfNeeded() const
|
||||
return (isMainFloating || isParentFloating) && !isMidScene && isPhoneOrPadNotFreeMultiWindow;
|
||||
}
|
||||
|
||||
void Session::SetKeybaordStateChangeListener(const NotifyKeyboardStateChangeFunc& func)
|
||||
void Session::SetKeyboardStateChangeListener(const NotifyKeyboardStateChangeFunc& func)
|
||||
{
|
||||
keyboardStateChangeFunc_ = func;
|
||||
if (state_ == SessionState::STATE_DISCONNECT) {
|
||||
return;
|
||||
}
|
||||
NotifySessionStateChange(state_);
|
||||
PostTask([weakThis = wptr(this), func, where = __func__]() {
|
||||
auto session = weakThis.promote();
|
||||
if (session == nullptr || func == nullptr) {
|
||||
TLOGNE(WmsLogTag::WMS_KEYBOARD, "%{public}s session or func is null", where);
|
||||
return;
|
||||
}
|
||||
session->keyboardStateChangeFunc_ = func;
|
||||
auto newState = session->GetSessionState(); // read and write state should in one thread
|
||||
if (newState == SessionState::STATE_ACTIVE) {
|
||||
newState = SessionState::STATE_FOREGROUND;
|
||||
} else if (newState == SessionState::STATE_INACTIVE) {
|
||||
newState = SessionState::STATE_BACKGROUND;
|
||||
} else if (newState == SessionState::STATE_DISCONNECT) {
|
||||
return;
|
||||
}
|
||||
session->NotifySessionStateChange(newState);
|
||||
TLOGNI(WmsLogTag::WMS_KEYBOARD, "%{public}s id: %{public}d, state_: %{public}d, newState: %{public}d",
|
||||
where, session->GetPersistentId(), session->GetSessionState(), newState);
|
||||
}, __func__);
|
||||
}
|
||||
|
||||
void Session::NotifyOccupiedAreaChangeInfo(sptr<OccupiedAreaChangeInfo> info,
|
||||
|
@ -1181,9 +1181,9 @@ WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation, bool w
|
||||
|
||||
WMError WindowSceneSessionImpl::ShowKeyboard(KeyboardViewMode mode)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Show keyboard with view mode: %{public}d", static_cast<uint32_t>(mode));
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Show keyboard with view mode: %{public}u", static_cast<uint32_t>(mode));
|
||||
if (mode >= KeyboardViewMode::VIEW_MODE_END) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "Invalid view mode: %{public}d. Use default view mode",
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "Invalid view mode: %{public}u. Use default view mode",
|
||||
static_cast<uint32_t>(mode));
|
||||
mode = KeyboardViewMode::NON_IMMERSIVE_MODE;
|
||||
}
|
||||
@ -3794,10 +3794,10 @@ WMError WindowSceneSessionImpl::SetCallingWindow(uint32_t callingSessionId)
|
||||
|
||||
WMError WindowSceneSessionImpl::ChangeKeyboardViewMode(KeyboardViewMode mode)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Start change keyboard view mode to %{public}d",
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Start change keyboard view mode to %{public}u",
|
||||
static_cast<uint32_t>(mode));
|
||||
if (mode >= KeyboardViewMode::VIEW_MODE_END) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "invalid view mode!");
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "Invalid view mode!");
|
||||
return WMError::WM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (mode == property_->GetKeyboardViewMode()) {
|
||||
@ -3809,7 +3809,7 @@ WMError WindowSceneSessionImpl::ChangeKeyboardViewMode(KeyboardViewMode mode)
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
}
|
||||
if (state_ != WindowState::STATE_SHOWN) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "keyboard is no shown");
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "The keyboard is not show status.");
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user