From 5452f8a9e613d0bdfd45b4a40f8b9f5e4e49d9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=87=E5=AD=9D=E5=9B=BD?= Date: Sat, 30 Aug 2025 09:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=BA=94=E7=94=A8DPI?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=AD=90?= =?UTF-8?q?=E7=AA=97=E8=B7=9F=E9=9A=8F=E7=88=B6=E7=AA=97=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 万孝国 --- .../napi/window_runtime/window_napi/js_window.cpp | 5 ++++- window_scene/session/host/src/main_session.cpp | 11 ++++++++--- wm/src/window_scene_session_impl.cpp | 6 ++++++ 3 files changed, 18 insertions(+), 4 deletions(-) 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 bf783a9d9b..5bbbb8ce18 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window.cpp +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window.cpp @@ -6989,7 +6989,8 @@ napi_value JsWindow::OnMaximize(napi_env env, napi_callback_info info) (GetType(env, argv[INDEX_ONE]) == napi_function ? argv[INDEX_ONE] : nullptr); napi_value result = nullptr; std::shared_ptr napiAsyncTask = CreateEmptyAsyncTask(env, lastParam, &result); - auto asyncTask = [windowToken = wptr(windowToken_), presentation, env, task = napiAsyncTask] { + const char* const where = __func__; + auto asyncTask = [windowToken = wptr(windowToken_), presentation, env, where, task = napiAsyncTask] { auto window = windowToken.promote(); if (window == nullptr) { task->Reject(env, @@ -7005,6 +7006,8 @@ napi_value JsWindow::OnMaximize(napi_env env, napi_callback_info info) task->Reject(env, JsErrUtils::CreateJsError(env, wmErrorCode, "[window][maximize]msg: Failed")); } + TLOGNI(WmsLogTag::WMS_PC, "%{public}s id:%{public}u presentation:%{public}d end, ret=%{public}d", + where, window->GetWindowId(), static_cast(presentation), ret); }; if (napi_send_event(env, asyncTask, napi_eprio_immediate, "OnMaximize") != napi_status::napi_ok) { napiAsyncTask->Reject(env, CreateJsError(env, diff --git a/window_scene/session/host/src/main_session.cpp b/window_scene/session/host/src/main_session.cpp index 221fbc14b4..2cbd7c4a7b 100644 --- a/window_scene/session/host/src/main_session.cpp +++ b/window_scene/session/host/src/main_session.cpp @@ -378,13 +378,18 @@ void MainSession::NotifySubAndDialogFollowRectChange(const WSRect& rect, bool is funcMap = notifySurfaceBoundsChangeFuncMap_; } WSRect newRect; + bool isCompatMode = IsInCompatScaleMode(); for (const auto& [sessionId, func] : funcMap) { auto subSession = GetSceneSessionById(sessionId); if (subSession && subSession->GetIsFollowParentLayout() && func) { - if (newRect.IsEmpty()) { - HookStartMoveRect(newRect, rect); + if (isCompatMode && GetCallingPid() != subSession->GetCallingPid()) { + if (newRect.IsEmpty()) { + HookStartMoveRect(newRect, rect); + } + func(newRect, isGlobal, needFlush); + } else { + func(rect, isGlobal, needFlush); } - func(newRect, isGlobal, needFlush); } } } diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index cf31a7e89a..44696d131e 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -5863,6 +5863,11 @@ WMError WindowSceneSessionImpl::SetDefaultDensityEnabled(bool enabled) return WMError::WM_OK; } + if (property_->IsAdaptToSimulationScale()) { + TLOGI(WmsLogTag::WMS_COMPAT, "compat mode not use default density"); + return WMError::WM_OK; + } + if (auto hostSession = GetHostSession()) { hostSession->OnDefaultDensityEnabled(enabled); } @@ -6724,6 +6729,7 @@ WMError WindowSceneSessionImpl::SetFollowParentWindowLayoutEnabled(bool isFollow return WMError::WM_ERROR_INVALID_SESSION; } WSError ret = GetHostSession()->SetFollowParentWindowLayoutEnabled(isFollow); + TLOGI(WmsLogTag::WMS_SUB, "id:%{public}d, isFollow:%{public}d", GetPersistentId(), isFollow); if (ret == WSError::WS_ERROR_DEVICE_NOT_SUPPORT) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } -- Gitee