!8923 修复window_impl中避让区域未同步通知

Merge pull request !8923 from ReCoder/cherry-pick-1725874565
This commit is contained in:
openharmony_ci 2024-09-10 08:23:32 +00:00 committed by Gitee
commit 02bab505b0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 3 deletions

View File

@ -415,7 +415,8 @@ private:
RSSurfaceNode::SharedPtr CreateSurfaceNode(std::string name, WindowType type); RSSurfaceNode::SharedPtr CreateSurfaceNode(std::string name, WindowType type);
void UpdateWindowStateUnfrozen(); void UpdateWindowStateUnfrozen();
void UpdateViewportConfig(const Rect& rect, const sptr<class Display>& display, WindowSizeChangeReason reason, void UpdateViewportConfig(const Rect& rect, const sptr<class Display>& display, WindowSizeChangeReason reason,
const std::shared_ptr<RSTransaction>& rsTransaction = nullptr); const std::shared_ptr<RSTransaction>& rsTransaction = nullptr,
const std::map<AvoidAreaType, AvoidArea>& avoidAreas = {});
void UpdateDecorEnable(bool needNotify = false); void UpdateDecorEnable(bool needNotify = false);
WMError SetFloatingMaximize(bool isEnter); WMError SetFloatingMaximize(bool isEnter);
WMError SetUIContentInner(const std::string& contentInfo, napi_env env, napi_value storage, WMError SetUIContentInner(const std::string& contentInfo, napi_env env, napi_value storage,

View File

@ -3316,11 +3316,15 @@ void WindowImpl::UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configura
void WindowImpl::UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) void WindowImpl::UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type)
{ {
WLOGI("Update AvoidArea, id: %{public}u", property_->GetWindowId()); WLOGI("Update AvoidArea, id: %{public}u", property_->GetWindowId());
auto display = SingletonContainer::IsDestroyed() ? nullptr :
SingletonContainer::Get<DisplayManager>().GetDisplayById(property_->GetDisplayId());
UpdateViewportConfig(GetRect(), display, WindowSizeChangeReason::UNDEFINED, nullptr, {{type, *avoidArea}});
NotifyAvoidAreaChange(avoidArea, type); NotifyAvoidAreaChange(avoidArea, type);
} }
void WindowImpl::UpdateViewportConfig(const Rect& rect, const sptr<Display>& display, WindowSizeChangeReason reason, void WindowImpl::UpdateViewportConfig(const Rect& rect, const sptr<Display>& display, WindowSizeChangeReason reason,
const std::shared_ptr<RSTransaction>& rsTransaction) const std::shared_ptr<RSTransaction>& rsTransaction,
const std::map<AvoidAreaType, AvoidArea>& avoidAreas)
{ {
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
if (uiContent_ == nullptr) { if (uiContent_ == nullptr) {
@ -3336,7 +3340,7 @@ void WindowImpl::UpdateViewportConfig(const Rect& rect, const sptr<Display>& dis
config.SetOrientation(static_cast<int32_t>(displayInfo->GetDisplayOrientation())); config.SetOrientation(static_cast<int32_t>(displayInfo->GetDisplayOrientation()));
} }
} }
uiContent_->UpdateViewportConfig(config, reason, rsTransaction); uiContent_->UpdateViewportConfig(config, reason, rsTransaction, avoidAreas);
WLOGFD("Id:%{public}u, windowRect:[%{public}d, %{public}d, %{public}u, %{public}u]", WLOGFD("Id:%{public}u, windowRect:[%{public}d, %{public}d, %{public}u, %{public}u]",
property_->GetWindowId(), rect.posX_, rect.posY_, rect.width_, rect.height_); property_->GetWindowId(), rect.posX_, rect.posY_, rect.width_, rect.height_);
} }