修复windows rect与surface rect大小不一致导致窗口大小异常问题

Signed-off-by: xingyanan <xingyanan2@huawei.com>
Change-Id: I30eddead8b0bdf810238fb2de60d1ee875c2e2d9
Signed-off-by: xingyanan <xingyanan2@huawei.com>
This commit is contained in:
xingyanan
2022-03-07 11:27:54 +08:00
parent b93aad4dcc
commit 199b5443ca
2 changed files with 9 additions and 5 deletions
+5 -5
View File
@@ -635,15 +635,15 @@ WMError WindowImpl::Show()
if (property_->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) {
WLOGFI("desktop window [id:%{public}d] is shown, minimize all app windows", property_->GetWindowId());
SingletonContainer::Get<WindowAdapter>().MinimizeAllAppWindows(property_->GetDisplayId());
for (auto& listener : lifecycleListeners_) {
if (listener != nullptr) {
listener->AfterForeground();
}
}
} else {
WLOGFI("window is already shown id: %{public}d, raise to top", property_->GetWindowId());
SingletonContainer::Get<WindowAdapter>().ProcessWindowTouchedEvent(property_->GetWindowId());
}
for (auto& listener : lifecycleListeners_) {
if (listener != nullptr) {
listener->AfterForeground();
}
}
return WMError::WM_OK;
}
SetDefaultOption();
@@ -231,8 +231,12 @@ void WindowLayoutPolicyCascade::UpdateLayoutRect(sptr<WindowNode>& node)
LimitWindowSize(node, displayRect_, winRect);
node->SetLayoutRect(winRect);
CalcAndSetNodeHotZone(winRect, node);
if (IsLayoutChanged(lastRect, winRect) || node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) {
node->GetWindowToken()->UpdateWindowRect(winRect, node->GetWindowSizeChangeReason());
}
// update node bounds
if (node->surfaceNode_ != nullptr) {
node->surfaceNode_->SetBounds(winRect.posX_, winRect.posY_, winRect.width_, winRect.height_);
}
}