mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-01 21:45:06 -04:00
修复最小化窗口再打开大小变化的问题
Signed-off-by: xingyanan <xingyanan2@huawei.com> Change-Id: Ic8b7adddfa1dda1a136799c0e9c68275d52c2ab4
This commit is contained in:
@@ -80,6 +80,7 @@ public:
|
||||
bool requestedVisibility_ { false };
|
||||
bool currentVisibility_ { false };
|
||||
bool hasDecorated_ { false };
|
||||
bool isDefultLayoutRect_ { false };
|
||||
bool isCovered_ { true }; // initial value true to ensure notification when this window is shown
|
||||
|
||||
private:
|
||||
|
||||
@@ -134,6 +134,7 @@ WMError WindowController::ResizeRect(uint32_t windowId, const Rect& rect, Window
|
||||
}
|
||||
} else if (reason == WindowSizeChangeReason::RESIZE) {
|
||||
node->hasDecorated_ = false;
|
||||
node->isDefultLayoutRect_ = false;
|
||||
newRect = { lastRect.posX_, lastRect.posY_, rect.width_, rect.height_ };
|
||||
} else if (reason == WindowSizeChangeReason::DRAG) {
|
||||
if (WindowHelper::IsMainFloatingWindow(node->GetWindowType(), node->GetWindowMode())) {
|
||||
@@ -148,7 +149,6 @@ WMError WindowController::ResizeRect(uint32_t windowId, const Rect& rect, Window
|
||||
newRect = rect;
|
||||
}
|
||||
}
|
||||
|
||||
property->SetWindowRect(newRect);
|
||||
WMError res = windowRoot_->UpdateWindowNode(windowId, WindowUpdateReason::UPDATE_RECT);
|
||||
if (res != WMError::WM_OK) {
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowLayoutPolicyCascade"};
|
||||
constexpr uint32_t WINDOW_CASCADE_HEIGHT = 48;
|
||||
constexpr uint32_t WINDOW_CASCADE_WIDTH = 48;
|
||||
}
|
||||
WindowLayoutPolicyCascade::WindowLayoutPolicyCascade(const Rect& displayRect, const uint64_t& screenId,
|
||||
sptr<WindowNode>& belowAppNode, sptr<WindowNode>& appNode, sptr<WindowNode>& aboveAppNode)
|
||||
@@ -353,20 +351,26 @@ void WindowLayoutPolicyCascade::Reorder()
|
||||
Rect rect = firstCascadeRect_;
|
||||
bool isFirstReorderedWindow = true;
|
||||
for (auto iter = appWindowNode_->children_.begin(); iter != appWindowNode_->children_.end(); iter++) {
|
||||
if ((*iter)->GetWindowType() == WindowType::WINDOW_TYPE_APP_MAIN_WINDOW) {
|
||||
auto node = *iter;
|
||||
if (node == nullptr) {
|
||||
WLOGFI("get node failed.");
|
||||
continue;
|
||||
}
|
||||
if (node->GetWindowType() == WindowType::WINDOW_TYPE_APP_MAIN_WINDOW) {
|
||||
if (isFirstReorderedWindow) {
|
||||
isFirstReorderedWindow = false;
|
||||
} else {
|
||||
rect = StepCascadeRect(rect);
|
||||
}
|
||||
(*iter)->hasDecorated_ = true;
|
||||
(*iter)->SetWindowRect(rect);
|
||||
if ((*iter)->GetWindowMode() != WindowMode::WINDOW_MODE_FLOATING) {
|
||||
(*iter)->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
(*iter)->GetWindowToken()->UpdateWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
node->hasDecorated_ = true;
|
||||
node->isDefultLayoutRect_ = true;
|
||||
node->SetWindowRect(rect);
|
||||
if (node->GetWindowMode() != WindowMode::WINDOW_MODE_FLOATING) {
|
||||
node->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
node->GetWindowToken()->UpdateWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
}
|
||||
WLOGFI("Cascade reorder Id: %{public}d, rect:[%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
(*iter)->GetWindowId(), rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
node->GetWindowId(), rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
}
|
||||
}
|
||||
LayoutWindowTree();
|
||||
@@ -399,8 +403,8 @@ Rect WindowLayoutPolicyCascade::GetCurCascadeRect(const sptr<WindowNode>& node)
|
||||
Rect WindowLayoutPolicyCascade::StepCascadeRect(Rect rect) const
|
||||
{
|
||||
float virtualPixelRatio = GetVirtualPixelRatio();
|
||||
uint32_t cascadeWidth = static_cast<uint32_t>(WINDOW_CASCADE_WIDTH * virtualPixelRatio);
|
||||
uint32_t cascadeHeight = static_cast<uint32_t>(WINDOW_CASCADE_HEIGHT * virtualPixelRatio);
|
||||
uint32_t cascadeWidth = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
uint32_t cascadeHeight = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
|
||||
Rect cascadeRect = {0, 0, 0, 0};
|
||||
cascadeRect.width_ = rect.width_;
|
||||
@@ -438,6 +442,7 @@ void WindowLayoutPolicyCascade::SetCascadeRect(const sptr<WindowNode>& node)
|
||||
rect = firstCascadeRect_;
|
||||
}
|
||||
node->hasDecorated_ = true;
|
||||
node->isDefultLayoutRect_ = true;
|
||||
WLOGFI("set cascadeRect :[%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
node->SetWindowRect(rect);
|
||||
|
||||
@@ -280,7 +280,7 @@ WMError WindowNodeContainer::RemoveWindowNode(sptr<WindowNode>& node)
|
||||
}
|
||||
node->requestedVisibility_ = false;
|
||||
node->currentVisibility_ = false;
|
||||
node->hasDecorated_ = false;
|
||||
node->hasDecorated_ = node->isDefultLayoutRect_ ? true : false;
|
||||
node->isCovered_ = true;
|
||||
std::vector<sptr<WindowVisibilityInfo>> infos = {new WindowVisibilityInfo(node->GetWindowId(),
|
||||
node->GetCallingPid(), node->GetCallingUid(), false)};
|
||||
|
||||
Reference in New Issue
Block a user