fix wrong window size when split mode switch to tile

Signed-off-by: jincanran <jincanran@huawei.com>
Change-Id: I08abb39c4d18d99e494191dcf9f18dac249ad77a
This commit is contained in:
jincanran
2022-03-16 11:25:55 +08:00
parent c106e4e79a
commit dbbd78c05e
6 changed files with 19 additions and 2 deletions
+1
View File
@@ -110,6 +110,7 @@ enum class WindowSizeChangeReason : uint32_t {
DRAG_END,
RESIZE,
MOVE,
HIDE,
};
enum class WindowLayoutMode : uint32_t {
+3
View File
@@ -1026,6 +1026,9 @@ void WindowImpl::UpdateRect(const struct Rect& rect, WindowSizeChangeReason reas
WLOGFI("winId:%{public}u, rect[%{public}d, %{public}d, %{public}u, %{public}u], vpr:%{public}f, reason:%{public}u",
GetWindowId(), rect.posX_, rect.posY_, rect.width_, rect.height_, virtualPixelRatio, reason);
property_->SetWindowRect(rect);
if (reason == WindowSizeChangeReason::HIDE) { // if hide, no follow-up notification required
return;
}
WLOGFI("sizeChange callback size: %{public}u", windowChangeListeners_.size());
for (auto& listener : windowChangeListeners_) {
if (listener != nullptr) {
@@ -35,6 +35,7 @@ public:
~WindowLayoutPolicyTile() = default;
void Launch() override;
void AddWindowNode(sptr<WindowNode>& node) override;
void UpdateWindowNode(sptr<WindowNode>& node) override;
void RemoveWindowNode(sptr<WindowNode>& node) override;
void UpdateLayoutRect(sptr<WindowNode>& node) override;
+1 -1
View File
@@ -145,7 +145,7 @@ void WindowLayoutPolicy::RemoveWindowNode(sptr<WindowNode>& node)
}
Rect winRect = node->GetWindowProperty()->GetWindowRect();
node->SetLayoutRect(winRect);
node->GetWindowToken()->UpdateWindowRect(winRect, node->GetWindowSizeChangeReason());
node->GetWindowToken()->UpdateWindowRect(winRect, WindowSizeChangeReason::HIDE);
}
void WindowLayoutPolicy::UpdateWindowNode(sptr<WindowNode>& node)
+12 -1
View File
@@ -97,6 +97,17 @@ void WindowLayoutPolicyTile::AddWindowNode(sptr<WindowNode>& node)
}
}
void WindowLayoutPolicyTile::UpdateWindowNode(sptr<WindowNode>& node)
{
WM_FUNCTION_TRACE();
WindowLayoutPolicy::UpdateWindowNode(node);
if (avoidTypes_.find(node->GetWindowType()) != avoidTypes_.end()) {
InitTileWindowRects();
AssignNodePropertyForTileWindows();
LayoutForegroundNodeQueue();
}
}
void WindowLayoutPolicyTile::RemoveWindowNode(sptr<WindowNode>& node)
{
WM_FUNCTION_TRACE();
@@ -111,7 +122,7 @@ void WindowLayoutPolicyTile::RemoveWindowNode(sptr<WindowNode>& node)
LayoutForegroundNodeQueue();
}
Rect winRect = node->GetWindowProperty()->GetWindowRect();
node->GetWindowToken()->UpdateWindowRect(winRect, node->GetWindowSizeChangeReason());
node->GetWindowToken()->UpdateWindowRect(winRect, WindowSizeChangeReason::HIDE);
}
void WindowLayoutPolicyTile::LayoutForegroundNodeQueue()
+1
View File
@@ -1082,6 +1082,7 @@ WMError WindowNodeContainer::SwitchLayoutPolicy(WindowLayoutMode dstMode, bool r
layoutPolicy_->Reorder();
DumpScreenWindowTree();
}
NotifyIfSystemBarTintChanged();
return WMError::WM_OK;
}