mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-22 04:55:33 -04:00
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:
@@ -110,6 +110,7 @@ enum class WindowSizeChangeReason : uint32_t {
|
||||
DRAG_END,
|
||||
RESIZE,
|
||||
MOVE,
|
||||
HIDE,
|
||||
};
|
||||
|
||||
enum class WindowLayoutMode : uint32_t {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1082,6 +1082,7 @@ WMError WindowNodeContainer::SwitchLayoutPolicy(WindowLayoutMode dstMode, bool r
|
||||
layoutPolicy_->Reorder();
|
||||
DumpScreenWindowTree();
|
||||
}
|
||||
NotifyIfSystemBarTintChanged();
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user