From 33674aec8ed4df1b0879fdd950e4b98fcf56dd21 Mon Sep 17 00:00:00 2001 From: maojiangping Date: Sat, 12 Feb 2022 16:39:07 +0800 Subject: [PATCH] add window animation flag Signed-off-by: maojiangping Change-Id: Ia80d9a2aaf57c589a1b9f9a623a4fe5f5d88c249 --- interfaces/innerkits/wm/wm_common.h | 5 +++++ utils/include/window_property.h | 3 +++ utils/src/window_property.cpp | 15 +++++++++++++++ wm/include/window_impl.h | 1 + wm/src/window_impl.cpp | 11 +++++++++++ 5 files changed, 35 insertions(+) diff --git a/interfaces/innerkits/wm/wm_common.h b/interfaces/innerkits/wm/wm_common.h index 2340e417..fe241945 100644 --- a/interfaces/innerkits/wm/wm_common.h +++ b/interfaces/innerkits/wm/wm_common.h @@ -169,6 +169,11 @@ enum class ColorSpace : uint32_t { COLOR_SPACE_WIDE_GAMUT, // Wide gamut color space. The specific wide color gamut depends on thr screen. }; +enum class WindowAnimation : uint32_t { + NONE, + DEFAULT, +}; + struct AvoidArea { Rect leftRect; Rect topRect; diff --git a/utils/include/window_property.h b/utils/include/window_property.h index ad5da828..273b424e 100644 --- a/utils/include/window_property.h +++ b/utils/include/window_property.h @@ -49,6 +49,7 @@ public: void SetSystemBarProperty(WindowType type, const SystemBarProperty& state); void SetDecorEnable(bool decorEnable); void SetHitOffset(const PointInfo& offset); + void SetAnimationFlag(uint32_t animationFlag); const std::string& GetWindowName() const; Rect GetWindowRect() const; @@ -69,6 +70,7 @@ public: const std::unordered_map& GetSystemBarProperty() const; bool GetDecorEnable() const; const PointInfo& GetHitOffset() const; + uint32_t GetAnimationFlag() const; virtual bool Marshalling(Parcel& parcel) const override; static sptr Unmarshalling(Parcel& parcel); @@ -90,6 +92,7 @@ private: uint32_t windowId_ { 0 }; uint32_t parentId_ { 0 }; PointInfo hitOffset_ { 0, 0 }; + uint32_t animationFlag_ { static_cast(WindowAnimation::DEFAULT) }; std::unordered_map sysBarPropMap_ { { WindowType::WINDOW_TYPE_STATUS_BAR, SystemBarProperty() }, diff --git a/utils/src/window_property.cpp b/utils/src/window_property.cpp index 0194074a..1b79e348 100644 --- a/utils/src/window_property.cpp +++ b/utils/src/window_property.cpp @@ -110,6 +110,11 @@ void WindowProperty::SetHitOffset(const PointInfo& offset) hitOffset_ = offset; } +void WindowProperty::SetAnimationFlag(uint32_t animationFlag) +{ + animationFlag_ = animationFlag; +} + void WindowProperty::ResumeLastWindowMode() { mode_ = lastMode_; @@ -213,6 +218,11 @@ const PointInfo& WindowProperty::GetHitOffset() const return hitOffset_; } +uint32_t WindowProperty::GetAnimationFlag() const +{ + return animationFlag_; +} + bool WindowProperty::MapMarshalling(Parcel& parcel) const { auto size = sysBarPropMap_.size(); @@ -337,6 +347,10 @@ bool WindowProperty::Marshalling(Parcel& parcel) const return false; } + // write parentId_ + if (!parcel.WriteUint32(animationFlag_)) { + return false; + } return true; } @@ -363,6 +377,7 @@ sptr WindowProperty::Unmarshalling(Parcel& parcel) property->SetDecorEnable(parcel.ReadBool()); PointInfo offset = {parcel.ReadInt32(), parcel.ReadInt32()}; property->SetHitOffset(offset); + property->SetAnimationFlag(parcel.ReadUint32()); return property; } } diff --git a/wm/include/window_impl.h b/wm/include/window_impl.h index 4dad2654..70043c7f 100644 --- a/wm/include/window_impl.h +++ b/wm/include/window_impl.h @@ -158,6 +158,7 @@ private: void ReadyToMoveOrDragWindow(int32_t globalX, int32_t globalY, int32_t pointId); void EndMoveOrDragWindow(int32_t pointId); bool IsPointerEventConsumed(); + void AdjustWindowAnimationFlag(); std::shared_ptr callback_ = std::make_shared(VsyncStation::VsyncCallback()); diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp index f6adf9e2..58e93343 100644 --- a/wm/src/window_impl.cpp +++ b/wm/src/window_impl.cpp @@ -52,6 +52,7 @@ WindowImpl::WindowImpl(const sptr& option) property_->SetDisplayId(option->GetDisplayId()); property_->SetWindowFlags(option->GetWindowFlags()); property_->SetHitOffset(option->GetHitOffset()); + AdjustWindowAnimationFlag(); auto& sysBarPropMap = option->GetSystemBarProperty(); for (auto it : sysBarPropMap) { property_->SetSystemBarProperty(it.first, it.second); @@ -243,6 +244,7 @@ WMError WindowImpl::SetWindowType(WindowType type) return WMError::WM_ERROR_INVALID_PARAM; } property_->SetWindowType(type); + AdjustWindowAnimationFlag(); return WMError::WM_OK; } if (property_->GetWindowType() != type) { @@ -925,6 +927,15 @@ bool WindowImpl::IsPointerEventConsumed() return startDragFlag_ || startMoveFlag_; } +void WindowImpl::AdjustWindowAnimationFlag() +{ + WindowType winType = property_->GetWindowType(); + if (winType == WindowType::WINDOW_TYPE_WALLPAPER || winType == WindowType::WINDOW_TYPE_DESKTOP || + winType == WindowType::WINDOW_TYPE_STATUS_BAR || winType == WindowType::WINDOW_TYPE_NAVIGATION_BAR) { + property_->SetAnimationFlag(static_cast(WindowAnimation::NONE)); + } +} + void WindowImpl::ConsumePointerEvent(std::shared_ptr& pointerEvent) { int32_t action = pointerEvent->GetPointerAction();