mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-18 16:24:27 -04:00
process node which is not showing when destroy display
Signed-off-by: l00574490 <liuqi149@huawei.com> Change-Id: Ia90c0a92439ded9a86ee59e38146cf5216090a09
This commit is contained in:
@@ -96,6 +96,7 @@ private:
|
||||
ScreenId GetScreenGroupId(DisplayId displayId, bool& isRecordedDisplay);
|
||||
void ProcessExpandDisplayCreate(DisplayId displayId, ScreenId screenGroupId);
|
||||
std::map<DisplayId, sptr<DisplayInfo>> GetAllDisplayInfos(const std::vector<DisplayId>& displayIdVec);
|
||||
void MoveNotShowingWindowToDefaultDisplay(DisplayId displayId);
|
||||
|
||||
std::recursive_mutex& mutex_;
|
||||
std::map<uint32_t, sptr<WindowNode>> windowNodeMap_;
|
||||
|
||||
@@ -294,8 +294,8 @@ void DisplayGroupController::MoveCrossNodeToTargetDisplay(const sptr<WindowNode>
|
||||
{
|
||||
node->isShowingOnMultiDisplays_ = false;
|
||||
// update showing display
|
||||
std::vector<DisplayId> newShownDisplays = { targetDisplayId };
|
||||
node->SetShowingDisplays(newShownDisplays);
|
||||
std::vector<DisplayId> newShowingDisplays = { targetDisplayId };
|
||||
node->SetShowingDisplays(newShowingDisplays);
|
||||
// update new displayId
|
||||
if (node->GetDisplayId() != targetDisplayId) {
|
||||
UpdateWindowDisplayId(node, targetDisplayId);
|
||||
@@ -318,8 +318,8 @@ void DisplayGroupController::MoveNotCrossNodeToDefaultDisplay(const sptr<WindowN
|
||||
newRect.posY_ = newRect.posY_ - srcDisplayRect.posY_ + dstDisplayRect.posY_;
|
||||
node->SetRequestRect(newRect);
|
||||
// update showing display
|
||||
std::vector<DisplayId> newShownDisplays = { defaultDisplayId_ };
|
||||
node->SetShowingDisplays(newShownDisplays);
|
||||
std::vector<DisplayId> newShowingDisplays = { defaultDisplayId_ };
|
||||
node->SetShowingDisplays(newShowingDisplays);
|
||||
// update new displayId
|
||||
UpdateWindowDisplayId(node, defaultDisplayId_);
|
||||
|
||||
|
||||
@@ -940,6 +940,23 @@ void WindowRoot::ProcessDisplayCreate(DisplayId displayId)
|
||||
}
|
||||
}
|
||||
|
||||
void WindowRoot::MoveNotShowingWindowToDefaultDisplay(DisplayId displayId)
|
||||
{
|
||||
DisplayId defaultDisplayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
for (auto& elem : windowNodeMap_) {
|
||||
auto& windowNode = elem.second;
|
||||
if (windowNode->GetDisplayId() == displayId && !windowNode->currentVisibility_) {
|
||||
std::vector<DisplayId> newShowingDisplays = { defaultDisplayId };
|
||||
windowNode->SetShowingDisplays(newShowingDisplays);
|
||||
windowNode->isShowingOnMultiDisplays_ = false;
|
||||
if (windowNode->GetWindowToken()) {
|
||||
windowNode->GetWindowToken()->UpdateDisplayId(windowNode->GetDisplayId(), defaultDisplayId);
|
||||
}
|
||||
windowNode->SetDisplayId(defaultDisplayId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WindowRoot::ProcessDisplayDestroy(DisplayId displayId)
|
||||
{
|
||||
ScreenId screenGroupId = DisplayManagerServiceInner::GetInstance().GetScreenGroupIdByDisplayId(displayId);
|
||||
@@ -972,7 +989,8 @@ void WindowRoot::ProcessDisplayDestroy(DisplayId displayId)
|
||||
DestroyWindowInner(node);
|
||||
}
|
||||
}
|
||||
|
||||
// move window which is not showing on destroied display to default display
|
||||
MoveNotShowingWindowToDefaultDisplay(displayId);
|
||||
WLOGFI("[Display Destroy] displayId: %{public}" PRIu64" ", displayId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user