!47107 set display id from parent when creating window

Merge pull request !47107 from zhanghaibo/getAndSetDisplay
This commit is contained in:
openharmony_ci 2024-10-30 08:15:02 +00:00 committed by Gitee
commit 902bcd3973
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -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_) {