mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 09:00:55 +00:00
Description: If window mode is undefined, set it from configuration.
Signed-off-by: xukunkun <xukunkun1@huawei.com>
This commit is contained in:
parent
e9af4fabea
commit
8e7f34a5d3
@ -72,7 +72,7 @@ public:
|
||||
private:
|
||||
Rect windowRect_ { 0, 0, 0, 0 };
|
||||
WindowType type_ { WindowType::WINDOW_TYPE_APP_MAIN_WINDOW };
|
||||
WindowMode mode_ { WindowMode::WINDOW_MODE_FULLSCREEN };
|
||||
WindowMode mode_ { WindowMode::WINDOW_MODE_UNDEFINED };
|
||||
bool focusable_ { true };
|
||||
bool touchable_ { true };
|
||||
DisplayId displayId_ { 0 };
|
||||
|
@ -28,6 +28,8 @@
|
||||
<exitSplitRatios>0.1 0.9</exitSplitRatios>
|
||||
<!--split screen ratios config-->
|
||||
<splitRatios>0.5 0.33 0.67</splitRatios>
|
||||
<!--default window mode config-->
|
||||
<defaultWindowMode>1</defaultWindowMode>
|
||||
<!--window animation config-->
|
||||
<windowAnimation>
|
||||
<timing>
|
||||
@ -88,4 +90,4 @@
|
||||
</shadow>
|
||||
</appWindows>
|
||||
</windowEffect>
|
||||
</Configs>
|
||||
</Configs>
|
||||
|
@ -138,8 +138,8 @@ private:
|
||||
Rect windowRect_ { 0, 0, 0, 0 }; // actual window rect
|
||||
bool decoStatus_ { false }; // window has been decorated or not
|
||||
WindowType type_ { WindowType::WINDOW_TYPE_APP_MAIN_WINDOW };
|
||||
WindowMode mode_ { WindowMode::WINDOW_MODE_FULLSCREEN };
|
||||
WindowMode lastMode_ { WindowMode::WINDOW_MODE_FULLSCREEN };
|
||||
WindowMode mode_ { WindowMode::WINDOW_MODE_UNDEFINED };
|
||||
WindowMode lastMode_ { WindowMode::WINDOW_MODE_UNDEFINED };
|
||||
uint32_t flags_ { 0 };
|
||||
bool isFullScreen_ { true };
|
||||
bool focusable_ { true };
|
||||
|
@ -131,6 +131,7 @@ struct AppWindowEffectConfig {
|
||||
struct SystemConfig : public Parcelable {
|
||||
bool isSystemDecorEnable_ = true;
|
||||
bool isStretchable_ = false;
|
||||
WindowMode defaultWindowMode_ = WindowMode::WINDOW_MODE_FULLSCREEN;
|
||||
AppWindowEffectConfig effectConfig_;
|
||||
|
||||
virtual bool Marshalling(Parcel& parcel) const override
|
||||
@ -139,6 +140,10 @@ struct SystemConfig : public Parcelable {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parvel.WriteUint32(static_cast<uint32_t>(defaultWindowMode_))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.WriteFloat(effectConfig_.fullScreenCornerRadius_) ||
|
||||
!parcel.WriteFloat(effectConfig_.splitCornerRadius_) ||
|
||||
!parcel.WriteFloat(effectConfig_.floatCornerRadius_)) {
|
||||
@ -168,6 +173,7 @@ struct SystemConfig : public Parcelable {
|
||||
SystemConfig* config = new SystemConfig();
|
||||
config->isSystemDecorEnable_ = parcel.ReadBool();
|
||||
config->isStretchable_ = parcel.ReadBool();
|
||||
config->defaultWindowMode_ = static_cast<WindowMode>(parcel.ReadUint32());
|
||||
config->effectConfig_.fullScreenCornerRadius_ = parcel.ReadFloat();
|
||||
config->effectConfig_.splitCornerRadius_ = parcel.ReadFloat();
|
||||
config->effectConfig_.floatCornerRadius_ = parcel.ReadFloat();
|
||||
|
@ -714,6 +714,25 @@ WMError WindowImpl::UpdateProperty(PropertyChangeAction action)
|
||||
return SingletonContainer::Get<WindowAdapter>().UpdateProperty(property_, action);
|
||||
}
|
||||
|
||||
void WindowImpl::GetConfigurationFromWMS() {
|
||||
if (SingletonContainer::Get<WindowAdapter>().GetSystemConfig(windowSystemConfig_) == WMError::WM_OK) {
|
||||
WLOGFI("get system decor enable:%{public}d", windowSystemConfig_.isSystemDecorEnable_);
|
||||
if (windowSystemConfig_.isSystemDecorEnable_) {
|
||||
property_->SetDecorEnable(true);
|
||||
}
|
||||
WLOGFI("get stretchable enable:%{public}d", windowSystemConfig_.isStretchable_);
|
||||
property_->SetStretchable(windowSystemConfig_.isStretchable_);
|
||||
// if window mode is undefined, set it from configuration
|
||||
if (property_->GetWindowMode() == WindowMode::WINDOW_MODE_UNDEFINED) {
|
||||
WindowMode mode_ = windowSystemConfig_.defaultWindowMode_;
|
||||
WLOGFI("get default window mode:%{public}u", mode_);
|
||||
if (mode_ == WindowMode::WINDOW_MODE_FULLSCREEN || mode_ == WindowMode::WINDOW_MODE_FLOATING) {
|
||||
property_->SetWindowMode(mode_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WindowImpl::GetConfigurationFromAbilityInfo()
|
||||
{
|
||||
auto abilityContext = AbilityRuntime::Context::ConvertTo<AbilityRuntime::AbilityContext>(context_);
|
||||
@ -925,7 +944,12 @@ WMError WindowImpl::Create(const std::string& parentName, const std::shared_ptr<
|
||||
SetSystemConfig();
|
||||
|
||||
if (WindowHelper::IsMainWindow(property_->GetWindowType())) {
|
||||
GetConfigurationFromWMS();
|
||||
GetConfigurationFromAbilityInfo();
|
||||
} else {
|
||||
if (property_->GetWindowMode() == WindowMode::WINDOW_MODE_UNDEFINED) {
|
||||
property_->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
WMError ret = SingletonContainer::Get<WindowAdapter>().CreateWindow(windowAgent, property_, surfaceNode_,
|
||||
windowId, token);
|
||||
|
@ -32,6 +32,7 @@ const std::map<std::string, WindowManagerConfig::ValueType> WindowManagerConfig:
|
||||
{ "duration", WindowManagerConfig::ValueType::INTS },
|
||||
{ "durationIn", WindowManagerConfig::ValueType::INTS },
|
||||
{ "durationOut", WindowManagerConfig::ValueType::INTS },
|
||||
{ "defaultWindowMode", WindowManagerConfig::ValueType::INTS },
|
||||
{ "windowAnimation", WindowManagerConfig::ValueType::MAP },
|
||||
{ "keyboardAnimation", WindowManagerConfig::ValueType::MAP },
|
||||
{ "timing", WindowManagerConfig::ValueType::MAP },
|
||||
|
@ -313,6 +313,13 @@ void WindowManagerService::ConfigureWindowManagerService()
|
||||
if (item.IsBool()) {
|
||||
systemConfig_.isStretchable_ = item.boolValue_;
|
||||
}
|
||||
item = config["defaultWindowMode"];
|
||||
if (item.IsInts()) {
|
||||
auto numbers = *item.intsValue_;
|
||||
if (numbers.size() == 1 && numbers[0] > 0) {
|
||||
systemConfig_.defaultWindowMode_ = static_cast<WindowMode>(static_cast<uint32_t>(numbers[0]));
|
||||
}
|
||||
}
|
||||
item = config["remoteAnimation"].GetProp("enable");
|
||||
if (item.IsBool()) {
|
||||
RemoteAnimation::isRemoteAnimationEnable_ = item.boolValue_;
|
||||
|
Loading…
Reference in New Issue
Block a user