From 7b2793ef4d1b762777502f84644237dbb468e813 Mon Sep 17 00:00:00 2001 From: zhanghaibo Date: Tue, 29 Oct 2024 15:48:48 +0800 Subject: [PATCH] set display id from parent when creating window Signed-off-by: zhanghaibo Change-Id: I140588ebb9422567d8fa59ccf14a82937d0057ee --- adapter/ohos/entrance/subwindow/subwindow_ohos.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adapter/ohos/entrance/subwindow/subwindow_ohos.cpp b/adapter/ohos/entrance/subwindow/subwindow_ohos.cpp index febb0644e69..e19212fa017 100644 --- a/adapter/ohos/entrance/subwindow/subwindow_ohos.cpp +++ b/adapter/ohos/entrance/subwindow/subwindow_ohos.cpp @@ -226,6 +226,10 @@ bool SubwindowOhos::InitContainer() windowOption->SetWindowRect({ 0, 0, defaultDisplay->GetWidth(), defaultDisplay->GetHeight() }); windowOption->SetWindowMode(Rosen::WindowMode::WINDOW_MODE_FLOATING); SetUIExtensionSubwindowFlag(windowOption, isAppSubwindow, parentWindow); + auto displayId = parentWindow->GetDisplayId(); + TAG_LOGI(AceLogTag::ACE_SUB_WINDOW, + "The display id obtained from parent window is %{public}u", (uint32_t)displayId); + windowOption->SetDisplayId(displayId); window_ = OHOS::Rosen::Window::Create("ARK_APP_SUBWINDOW_" + windowTag + parentWindowName + std::to_string(windowId_), windowOption, parentWindow->GetContext()); if (!window_) { -- Gitee