diff --git a/interfaces/innerkits/wm/wm_common.h b/interfaces/innerkits/wm/wm_common.h index c887a044e7..e4df40c12d 100644 --- a/interfaces/innerkits/wm/wm_common.h +++ b/interfaces/innerkits/wm/wm_common.h @@ -1066,8 +1066,8 @@ struct VsyncCallback { }; struct WindowLimits { - uint32_t maxWidth_ = INT32_MAX; - uint32_t maxHeight_ = INT32_MAX; + uint32_t maxWidth_ = UINT32_MAX; + uint32_t maxHeight_ = UINT32_MAX; uint32_t minWidth_ = 1; uint32_t minHeight_ = 1; float maxRatio_ = FLT_MAX; diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window.cpp b/interfaces/kits/napi/window_runtime/window_napi/js_window.cpp index 6f55967b7f..0974dcffb6 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window.cpp +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window.cpp @@ -823,7 +823,7 @@ napi_value JsWindow::KeepKeyboardOnFocus(napi_env env, napi_callback_info info) napi_value JsWindow::EnableDrag(napi_env env, napi_callback_info info) { - TLOGD(WmsLogTag::WMS_LAYOUT, "[NAPI] EnableDrag"); + TLOGD(WmsLogTag::WMS_LAYOUT, "[NAPI]"); JsWindow* me = CheckParamsAndGetThis(env, info); return (me != nullptr) ? me->OnEnableDrag(env, info) : nullptr; } @@ -958,7 +958,7 @@ napi_value JsWindow::RequestFocus(napi_env env, napi_callback_info info) napi_value JsWindow::StartMoving(napi_env env, napi_callback_info info) { - TLOGD(WmsLogTag::WMS_IMMS, "[NAPI]StartMoving"); + TLOGD(WmsLogTag::WMS_IMMS, "[NAPI]"); JsWindow* me = CheckParamsAndGetThis(env, info); return (me != nullptr) ? me->OnStartMoving(env, info) : nullptr; } @@ -2281,7 +2281,7 @@ napi_value JsWindow::OnSetDialogBackGestureEnabled(napi_env env, napi_callback_i wptr weakToken(windowToken_); std::shared_ptr errCodePtr = std::make_shared(WmErrorCode::WM_OK); - NapiAsyncTask::ExecuteCallback execute = [weakToken, isEnabled, errCodePtr]() { + NapiAsyncTask::ExecuteCallback execute = [weakToken, isEnabled, errCodePtr] { if (errCodePtr == nullptr) { return; } @@ -2996,7 +2996,7 @@ napi_value JsWindow::OnSetSystemBarProperties(napi_env env, napi_callback_info i { WMError errCode = WMError::WM_OK; if (windowToken_ == nullptr) { - TLOGE(WmsLogTag::WMS_IMMS, "windowToken_ is nullptr"); + TLOGE(WmsLogTag::WMS_IMMS, "windowToken is nullptr"); errCode = WMError::WM_ERROR_NULLPTR; } size_t argc = 4; @@ -3791,7 +3791,7 @@ napi_value JsWindow::OnSetTopmost(napi_env env, napi_callback_info info) wptr weakToken(windowToken_); std::shared_ptr errCodePtr = std::make_shared(WmErrorCode::WM_OK); - NapiAsyncTask::ExecuteCallback execute = [weakToken, topmost, errCodePtr]() { + NapiAsyncTask::ExecuteCallback execute = [weakToken, topmost, errCodePtr] { if (errCodePtr == nullptr) { return; } @@ -3954,7 +3954,7 @@ napi_value JsWindow::OnSetWindowKeepScreenOn(napi_env env, napi_callback_info in } wptr weakToken(windowToken_); std::shared_ptr errCodePtr = std::make_shared(WmErrorCode::WM_OK); - NapiAsyncTask::ExecuteCallback execute = [weakToken, keepScreenOn, errCodePtr] () { + NapiAsyncTask::ExecuteCallback execute = [weakToken, keepScreenOn, errCodePtr] { if (errCodePtr == nullptr) { return; } @@ -5751,7 +5751,7 @@ napi_value JsWindow::OnSetHandwritingFlag(napi_env env, napi_callback_info info) napi_get_value_bool(env, nativeBool, &isAddFlag); wptr weakToken(windowToken_); std::shared_ptr errCodePtr = std::make_shared(WmErrorCode::WM_OK); - NapiAsyncTask::ExecuteCallback execute = [weakToken, isAddFlag, errCodePtr]() { + NapiAsyncTask::ExecuteCallback execute = [weakToken, isAddFlag, errCodePtr] { if (errCodePtr == nullptr) { return; } @@ -6124,10 +6124,10 @@ napi_value JsWindow::OnEnableDrag(napi_env env, napi_callback_info info) } NapiAsyncTask::ExecuteCallback JsWindow::GetEnableDragExecuteCallback(bool enableDrag, const wptr& weakToken, - std::shared_ptr &errCodePtr) const + std::shared_ptr& errCodePtr) const { NapiAsyncTask::ExecuteCallback execute = - [weakToken, enableDrag, errCodePtr]() { + [weakToken, enableDrag, errCodePtr] { if (errCodePtr == nullptr) { return; } @@ -6169,16 +6169,12 @@ napi_value JsWindow::OnSetWindowLimits(napi_env env, napi_callback_info info) size_t argc = 4; napi_value argv[4] = {nullptr}; napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); - if (argc < 1) { + if (argc < 1 || argv[0] == nullptr) { WLOGFE("Argc is invalid: %{public}zu", argc); return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); } - napi_value nativeObj = argv[0]; - if (nativeObj == nullptr) { - return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); - } WindowLimits windowLimits; - if (!ParseWindowLimits(env, nativeObj, windowLimits)) { + if (!ParseWindowLimits(env, argv[0], windowLimits)) { WLOGFE("Failed to convert object to windowLimits"); return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); } @@ -6253,7 +6249,7 @@ napi_value JsWindow::OnSetWindowDecorVisible(napi_env env, napi_callback_info in size_t argc = 4; napi_value argv[4] = {nullptr}; napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); - if (argc < 1) { + if (argc < 1 || argv[0] == nullptr) { WLOGFE("Argc is invalid: %{public}zu", argc); return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); } @@ -6261,15 +6257,10 @@ napi_value JsWindow::OnSetWindowDecorVisible(napi_env env, napi_callback_info in WLOGFE("WindowToken_ is nullptr"); return NapiThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); } - napi_value nativeVal = argv[0]; - if (nativeVal == nullptr) { - WLOGFE("Failed to convert parameter to visible"); - return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); - } bool isVisible = true; WmErrorCode errCode = WmErrorCode::WM_OK; CHECK_NAPI_RETCODE(errCode, WmErrorCode::WM_ERROR_INVALID_PARAM, - napi_get_value_bool(env, nativeVal, &isVisible)); + napi_get_value_bool(env, argv[0], &isVisible)); if (errCode == WmErrorCode::WM_ERROR_INVALID_PARAM) { return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); } @@ -6670,7 +6661,7 @@ void SetWindowGrayScaleTask(const wptr& weakToken, double grayScale, NapiAsyncTask::ExecuteCallback& execute, NapiAsyncTask::CompleteCallback& complete) { std::shared_ptr err = std::make_shared(WmErrorCode::WM_OK); - execute = [weakToken, grayScale, err]() { + execute = [weakToken, grayScale, err] { if (err == nullptr) { TLOGE(WmsLogTag::DEFAULT, "wm error code is null"); return; @@ -6906,7 +6897,7 @@ napi_value JsWindow::OnStartMoving(napi_env env, napi_callback_info info) } wptr weakToken(windowToken_); std::shared_ptr err = std::make_shared(WmErrorCode::WM_OK); - NapiAsyncTask::ExecuteCallback execute = [this, weakToken, err] () { + NapiAsyncTask::ExecuteCallback execute = [this, weakToken, err] { if (err == nullptr) { TLOGE(WmsLogTag::WMS_SYSTEM, "wm error code is null."); return; diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window.h b/interfaces/kits/napi/window_runtime/window_napi/js_window.h index 4ac0550d59..cc02e2c1d3 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window.h +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window.h @@ -338,7 +338,7 @@ private: std::shared_ptr jsTransControllerObj_ = nullptr; NapiAsyncTask::ExecuteCallback GetEnableDragExecuteCallback(bool enableDrag, const wptr& weakToken, - std::shared_ptr &errCodePtr) const; + std::shared_ptr& errCodePtr) const; NapiAsyncTask::CompleteCallback GetEnableDragCompleteCallback(const std::shared_ptr& errCodePtr) const; }; } // namespace Rosen diff --git a/previewer/include/window.h b/previewer/include/window.h index 8bc6e1ee2f..6cb1fb44fe 100644 --- a/previewer/include/window.h +++ b/previewer/include/window.h @@ -316,9 +316,9 @@ public: virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) = 0; virtual WMError RegisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0; virtual WMError UnregisterWindowVisibilityChangeListener(const WindowVisibilityListenerSptr& listener) = 0; - virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; }; - virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; }; - virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }; + virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; } + virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_OK; } + virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; @@ -379,7 +379,7 @@ public: { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } - virtual WMError Recover(uint32_t reason = 0) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }; + virtual WMError Recover(uint32_t reason = 0) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } virtual WMError Maximize(MaximizePresentation present) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } diff --git a/previewer/include/wm_common.h b/previewer/include/wm_common.h index 05d99ba96f..43b94c5702 100644 --- a/previewer/include/wm_common.h +++ b/previewer/include/wm_common.h @@ -662,8 +662,8 @@ enum class WindowUpdateType : int32_t { }; struct WindowLimits { - uint32_t maxWidth_ = INT32_MAX; - uint32_t maxHeight_ = INT32_MAX; + uint32_t maxWidth_ = UINT32_MAX; + uint32_t maxHeight_ = UINT32_MAX; uint32_t minWidth_ = 1; uint32_t minHeight_ = 1; float maxRatio_ = FLT_MAX; diff --git a/window_scene/session/host/include/zidl/session_interface.h b/window_scene/session/host/include/zidl/session_interface.h index bf5ad6a4ef..7851050953 100644 --- a/window_scene/session/host/include/zidl/session_interface.h +++ b/window_scene/session/host/include/zidl/session_interface.h @@ -50,8 +50,8 @@ public: /** * @brief Receive session event from application. * - * This function provides the ability for applications to move window.\n - * This interface will take effect after touch down event.\n + * This function provides the ability for applications to move window. + * This interface will take effect after touch down event. * * @param event Indicates the {@link SessionEvent} * @return Returns WSError::WS_OK if called success, otherwise failed. @@ -214,8 +214,8 @@ public: * @brief Update the required params to system. * * Update the required rect and reason to determine the final size of pip window. Called when start pip, - * show pip window, update pip size and pip restore.\n - * Make sure the caller's process is same with the process which created pip window.\n + * show pip window, update pip size and pip restore. + * Make sure the caller's process is same with the process which created pip window. * * @param rect Indicates the {@link Rect} structure containing required size and position. * @param reason Indicates the {@link SizeChangeReason} reason. @@ -226,8 +226,8 @@ public: /** * @brief Update the pip control status to pip control panel. * - * Called when the specified component's status needs to be updated.\n - * Make sure the caller's process is same with the process which created pip window.\n + * Called when the specified component's status needs to be updated. + * Make sure the caller's process is same with the process which created pip window. * * @param controlType Indicates the {@link WsPiPControlType} component in pip control panel. * @param status Indicates the {@link WsPiPControlStatus} status of specified component. diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 21faaf02c5..0596cf80d9 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -2291,8 +2291,8 @@ WSError SceneSession::TransferPointerEventInner(const std::shared_ptrGetWindowMode() == WindowMode::WINDOW_MODE_FLOATING && property->GetDragEnabled()) - || isDragEnabledSystemWindow) { + if ((property->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING && property->GetDragEnabled()) || + isDragEnabledSystemWindow) { if ((systemConfig_.IsPcWindow() || IsFreeMultiWindowMode() || (property->GetIsPcAppInPad() && !isMainWindow)) && moveDragController_->ConsumeDragEvent(pointerEvent, winRect_, property, systemConfig_)) { diff --git a/window_scene/session_manager/src/scene_input_manager.cpp b/window_scene/session_manager/src/scene_input_manager.cpp index 3b89ac18fe..ce00de2ade 100644 --- a/window_scene/session_manager/src/scene_input_manager.cpp +++ b/window_scene/session_manager/src/scene_input_manager.cpp @@ -333,7 +333,7 @@ void SceneInputManager::FlushChangeInfoToMMI(const std::map& displayInfos, const std::vector& windowInfoList) { - int32_t focusId = Rosen::SceneSessionManager::GetInstance().GetFocusedSessionId(); + int32_t focusId = SceneSessionManager::GetInstance().GetFocusedSessionId(); if (focusId != lastFocusId_) { lastFocusId_ = focusId; lastDisplayInfos_ = displayInfos; @@ -380,7 +380,7 @@ void SceneInputManager::UpdateFocusedSessionId(int32_t focusedSessionId) void DumpUIExtentionWindowInfo(const MMI::WindowInfo& windowInfo) { - auto sceneSession = Rosen::SceneSessionManager::GetInstance().GetSceneSession(windowInfo.id); + auto sceneSession = SceneSessionManager::GetInstance().GetSceneSession(windowInfo.id); if (sceneSession == nullptr) { TLOGE(WmsLogTag::WMS_EVENT, "sceneSession is null"); return; @@ -410,7 +410,7 @@ void SceneInputManager::PrintWindowInfo(const std::vector& wind if (windowEventID == UINT32_MAX) { windowEventID = 0; } - focusedSessionId_ = Rosen::SceneSessionManager::GetInstance().GetFocusedSessionId(); + focusedSessionId_ = SceneSessionManager::GetInstance().GetFocusedSessionId(); std::unordered_map currWindowDefaultHotArea; static std::unordered_map lastWindowDefaultHotArea; for (auto& e : windowInfoList) { diff --git a/window_scene/session_manager/src/scene_session_dirty_manager.cpp b/window_scene/session_manager/src/scene_session_dirty_manager.cpp index 55c986e224..9210012f8f 100644 --- a/window_scene/session_manager/src/scene_session_dirty_manager.cpp +++ b/window_scene/session_manager/src/scene_session_dirty_manager.cpp @@ -144,7 +144,7 @@ void SceneSessionDirtyManager::CalTransform(const sptr& sceneSessi } transform = Matrix3f::IDENTITY; bool isRotate = sceneSession->GetSessionInfo().isRotable_; - auto displayMode = Rosen::ScreenSessionManagerClient::GetInstance().GetFoldDisplayMode(); + auto displayMode = ScreenSessionManagerClient::GetInstance().GetFoldDisplayMode(); if (isRotate || !sceneSession->GetSessionInfo().isSystem_ || static_cast(displayMode) == MMI::DisplayMode::FULL || (static_cast(displayMode) == MMI::DisplayMode::MAIN && @@ -366,7 +366,7 @@ bool SceneSessionDirtyManager::IsFilterSession(const sptr& sceneSe } else if (sceneSession->IsSystemSession() && sceneSession->IsVisible() && sceneSession->IsSystemActive()) { return false; } - if (!Rosen::SceneSessionManager::GetInstance().IsSessionVisible(sceneSession)) { + if (!SceneSessionManager::GetInstance().IsSessionVisible(sceneSession)) { return true; } return false; @@ -453,7 +453,7 @@ std::pair, std::vector windowInfoList; std::vector> pixelMapList; - const auto sceneSessionMap = Rosen::SceneSessionManager::GetInstance().GetSceneSessionMap(); + const auto sceneSessionMap = SceneSessionManager::GetInstance().GetSceneSessionMap(); // all input event should trans to dialog window if dialog exists const auto dialogMap = GetDialogSessionMap(sceneSessionMap); uint32_t maxHotAreasNum = 0; diff --git a/window_scene/test/unittest/scene_session_test.cpp b/window_scene/test/unittest/scene_session_test.cpp index 2cb826a5f7..504c42e00e 100644 --- a/window_scene/test/unittest/scene_session_test.cpp +++ b/window_scene/test/unittest/scene_session_test.cpp @@ -1113,7 +1113,7 @@ HWTEST_F(SceneSessionTest, TransferPointerEvent, Function | SmallTest | Level2) EXPECT_NE(sceneSession, nullptr); std::shared_ptr pointerEvent = nullptr; ASSERT_EQ(sceneSession->TransferPointerEvent(pointerEvent), WSError::WS_ERROR_NULLPTR); - std::shared_ptr pointerEvent_ = MMI::PointerEvent::Create(); + std::shared_ptr pointerEvent_ = MMI::PointerEvent::Create(); sptr property = new WindowSessionProperty(); property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING); property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL); diff --git a/window_scene/test/unittest/system_session_test.cpp b/window_scene/test/unittest/system_session_test.cpp index d8d8737b59..580899ecdd 100644 --- a/window_scene/test/unittest/system_session_test.cpp +++ b/window_scene/test/unittest/system_session_test.cpp @@ -159,7 +159,7 @@ HWTEST_F(SystemSessionTest, NotifyClientToUpdateRect01, Function | SmallTest | L */ HWTEST_F(SystemSessionTest, CheckPointerEventDispatch, Function | SmallTest | Level1) { - std::shared_ptr pointerEvent_ = MMI::PointerEvent::Create(); + std::shared_ptr pointerEvent_ = MMI::PointerEvent::Create(); SessionInfo info; info.abilityName_ = "CheckPointerEventDispatch"; info.bundleName_ = "CheckPointerEventDispatchBundleName"; diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 5a4ad63d78..a8f1920e18 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -752,7 +752,7 @@ bool WindowSceneSessionImpl::HandlePointDownEvent(const std::shared_ptrSendPointEventForMoveDrag(pointerEvent); } else { hostSession->ProcessPointDownSession(pointerItem.GetDisplayX(), pointerItem.GetDisplayY());