mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-19 17:08:11 -04:00
add window animation flag
Signed-off-by: maojiangping <maojiangping@huawei.com> Change-Id: Ia80d9a2aaf57c589a1b9f9a623a4fe5f5d88c249
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<WindowType, SystemBarProperty>& GetSystemBarProperty() const;
|
||||
bool GetDecorEnable() const;
|
||||
const PointInfo& GetHitOffset() const;
|
||||
uint32_t GetAnimationFlag() const;
|
||||
|
||||
virtual bool Marshalling(Parcel& parcel) const override;
|
||||
static sptr<WindowProperty> 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<uint32_t>(WindowAnimation::DEFAULT) };
|
||||
|
||||
std::unordered_map<WindowType, SystemBarProperty> sysBarPropMap_ {
|
||||
{ WindowType::WINDOW_TYPE_STATUS_BAR, SystemBarProperty() },
|
||||
|
||||
@@ -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> WindowProperty::Unmarshalling(Parcel& parcel)
|
||||
property->SetDecorEnable(parcel.ReadBool());
|
||||
PointInfo offset = {parcel.ReadInt32(), parcel.ReadInt32()};
|
||||
property->SetHitOffset(offset);
|
||||
property->SetAnimationFlag(parcel.ReadUint32());
|
||||
return property;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<VsyncStation::VsyncCallback> callback_ =
|
||||
std::make_shared<VsyncStation::VsyncCallback>(VsyncStation::VsyncCallback());
|
||||
|
||||
@@ -52,6 +52,7 @@ WindowImpl::WindowImpl(const sptr<WindowOption>& 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<uint32_t>(WindowAnimation::NONE));
|
||||
}
|
||||
}
|
||||
|
||||
void WindowImpl::ConsumePointerEvent(std::shared_ptr<MMI::PointerEvent>& pointerEvent)
|
||||
{
|
||||
int32_t action = pointerEvent->GetPointerAction();
|
||||
|
||||
Reference in New Issue
Block a user