mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-19 17:08:11 -04:00
fix MakeExpand creating redundant display error
Signed-off-by: Klaus_q <wangqi175@huawei.com> Change-Id: Ia3c1c4a11794ad35ab3bbd56de48333bacaab2a1
This commit is contained in:
@@ -45,7 +45,6 @@ public:
|
||||
sptr<AbstractDisplay> GetAbstractDisplay(DisplayId displayId) const;
|
||||
sptr<AbstractDisplay> GetAbstractDisplayByScreen(ScreenId screenId) const;
|
||||
std::vector<DisplayId> GetAllDisplayIds() const;
|
||||
void AddDisplayForExpandScreen(sptr<AbstractScreen> absScreen);
|
||||
void SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze);
|
||||
|
||||
private:
|
||||
|
||||
@@ -390,6 +390,14 @@ void AbstractDisplayController::AddScreenToMirrorLocked(sptr<AbstractScreen> abs
|
||||
|
||||
void AbstractDisplayController::AddScreenToExpandLocked(sptr<AbstractScreen> absScreen)
|
||||
{
|
||||
for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); iter++) {
|
||||
sptr<AbstractDisplay> abstractDisplay = iter->second;
|
||||
if (abstractDisplay->GetAbstractScreenId() == absScreen->dmsId_) {
|
||||
WLOGE("error, screenId: %{public}" PRIu64" already has corresponding display",
|
||||
absScreen->dmsId_);
|
||||
return;
|
||||
}
|
||||
}
|
||||
WLOGI("bind display to expand. screen:%{public}" PRIu64"", absScreen->dmsId_);
|
||||
sptr<SupportedScreenModes> info;
|
||||
if (absScreen->type_ == ScreenType::VIRTUAL) {
|
||||
@@ -417,22 +425,6 @@ void AbstractDisplayController::AddScreenToExpandLocked(sptr<AbstractScreen> abs
|
||||
DisplayManagerAgentController::GetInstance().OnDisplayCreate(display->ConvertToDisplayInfo());
|
||||
}
|
||||
|
||||
void AbstractDisplayController::AddDisplayForExpandScreen(sptr<AbstractScreen> absScreen)
|
||||
{
|
||||
for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); iter++) {
|
||||
sptr<AbstractDisplay> abstractDisplay = iter->second;
|
||||
if (abstractDisplay->GetAbstractScreenId() == absScreen->dmsId_) {
|
||||
WLOGE("error, screenId: %{public}" PRIu64" already has corresponding display",
|
||||
absScreen->dmsId_);
|
||||
return;
|
||||
}
|
||||
}
|
||||
WLOGI("screenId: %{public}" PRIu64" has no corresponding display, create new display.",
|
||||
absScreen->dmsId_);
|
||||
AddScreenToExpandLocked(absScreen);
|
||||
}
|
||||
|
||||
|
||||
void AbstractDisplayController::SetFreeze(std::vector<DisplayId> displayIds, bool toFreeze)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetAllFreeze");
|
||||
|
||||
@@ -481,10 +481,6 @@ ScreenId DisplayManagerService::MakeExpand(std::vector<ScreenId> expandScreenIds
|
||||
if (iter != allExpandScreenIds.end()) {
|
||||
allExpandScreenIds.erase(iter);
|
||||
}
|
||||
for (ScreenId expandScreenId : allExpandScreenIds) {
|
||||
auto expandScreen = abstractScreenController_->GetAbstractScreen(expandScreenId);
|
||||
abstractDisplayController_->AddDisplayForExpandScreen(expandScreen);
|
||||
}
|
||||
SetShotScreen(defaultScreenId, shotScreenIds);
|
||||
WM_SCOPED_TRACE("dms:MakeExpand");
|
||||
if (!allExpandScreenIds.empty() && !abstractScreenController_->MakeExpand(allExpandScreenIds, startPoints)) {
|
||||
|
||||
Reference in New Issue
Block a user