mirror of
https://github.com/openharmony/window_window_manager.git
synced 2026-08-25 00:03:00 -04:00
@@ -285,8 +285,15 @@ void VsyncStation::SetUiDvsyncSwitch(bool dvsyncSwitch)
|
||||
|
||||
void VsyncStation::DecreaseRequestVsyncTimes()
|
||||
{
|
||||
requestVsyncTimes_--;
|
||||
requestVsyncTimes_ = std::max(requestVsyncTimes_.load(), 0);
|
||||
int32_t current = 0;
|
||||
int32_t desired = 0;
|
||||
do {
|
||||
current = requestVsyncTimes_.load();
|
||||
if (current == 0) {
|
||||
break;
|
||||
}
|
||||
desired = current - 1;
|
||||
} while (!requestVsyncTimes_.compare_exchange_weak(current, desired));
|
||||
}
|
||||
|
||||
} // namespace Rosen
|
||||
|
||||
@@ -861,7 +861,7 @@ private:
|
||||
* Window Immersive
|
||||
*/
|
||||
void SetSystemBarPropertyForRotation(const std::map<WindowType, SystemBarProperty>& properties);
|
||||
std::map<Rosen::WindowType, Rosen::SystemBarProperty> GetSystemBarPropertyForRotation();
|
||||
std::map<Rosen::WindowType, Rosen::SystemBarProperty>& GetSystemBarPropertyForRotation();
|
||||
void GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea);
|
||||
void GetCutoutAvoidArea(WSRect& rect, AvoidArea& avoidArea);
|
||||
void GetKeyboardAvoidArea(WSRect& rect, AvoidArea& avoidArea);
|
||||
|
||||
@@ -2441,77 +2441,6 @@ WSError SceneSession::GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoid
|
||||
}, __func__);
|
||||
}
|
||||
|
||||
void SceneSession::SetSessionGetTargetOrientationConfigInfoCallback(
|
||||
const NotifySessionGetTargetOrientationConfigInfoFunc& func)
|
||||
{
|
||||
PostTask([weakThis = wptr(this), func, where = __func__] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_ROTATION, "%{public}s session is null", where);
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
session->sessionGetTargetOrientationConfigInfoFunc_ = func;
|
||||
return WSError::WS_OK;
|
||||
}, __func__);
|
||||
}
|
||||
|
||||
WSError SceneSession::GetTargetOrientationConfigInfo(Orientation targetOrientation,
|
||||
const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties)
|
||||
{
|
||||
PostTask(
|
||||
[weakThis = wptr(this), targetOrientation, properties, where = __func__] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_ROTATION, "%{public}s session is null", where);
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
session->SetSystemBarPropertyForRotation(properties);
|
||||
if (session->sessionGetTargetOrientationConfigInfoFunc_) {
|
||||
session->sessionGetTargetOrientationConfigInfoFunc_(static_cast<uint32_t>(targetOrientation));
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
},
|
||||
__func__);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
WSError SceneSession::NotifyRotationProperty(int32_t rotation, uint32_t width, uint32_t height)
|
||||
{
|
||||
PostTask(
|
||||
[weakThis = wptr(this), rotation, width, height, where = __func__] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_ROTATION, "%{public}s session is null", where);
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
WSRect wsrect = { 0, 0, width, height };
|
||||
auto properties = session->GetSystemBarPropertyForRotation();
|
||||
std::map<AvoidAreaType, AvoidArea> avoidAreas;
|
||||
// session->GetAvoidAreasByRotation(rotation, wsrect, properties, avoidAreas); //
|
||||
// 此行代码依赖沉浸式,需要先注释
|
||||
if (!session->sessionStage_) {
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
Rect rect = { wsrect.posX_, wsrect.posY_, wsrect.width_, wsrect.height_ };
|
||||
OrientationInfo info = { rotation, rect, avoidAreas };
|
||||
session->sessionStage_->NotifyTargetRotationInfo(info);
|
||||
return WSError::WS_OK;
|
||||
},
|
||||
__func__);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
void SceneSession::SetSystemBarPropertyForRotation(
|
||||
const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties)
|
||||
{
|
||||
targetSystemBarProperty_ = properties;
|
||||
}
|
||||
|
||||
std::map<Rosen::WindowType, Rosen::SystemBarProperty> SceneSession::GetSystemBarPropertyForRotation()
|
||||
{
|
||||
return targetSystemBarProperty_;
|
||||
}
|
||||
|
||||
WSError SceneSession::UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type)
|
||||
{
|
||||
if (!sessionStage_) {
|
||||
@@ -7199,6 +7128,76 @@ void SceneSession::AddSidebarBlur()
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::SetSessionGetTargetOrientationConfigInfoCallback(
|
||||
const NotifySessionGetTargetOrientationConfigInfoFunc& func)
|
||||
{
|
||||
PostTask(
|
||||
[weakThis = wptr(this), func, where = __func__] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_ROTATION, "%{public}s session is null", where);
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
session->sessionGetTargetOrientationConfigInfoFunc_ = func;
|
||||
return WSError::WS_OK;
|
||||
}, __func__);
|
||||
}
|
||||
|
||||
WSError SceneSession::GetTargetOrientationConfigInfo(Orientation targetOrientation,
|
||||
const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties)
|
||||
{
|
||||
PostTask(
|
||||
[weakThis = wptr(this), targetOrientation, properties, where = __func__] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_ROTATION, "%{public}s session is null", where);
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
session->SetSystemBarPropertyForRotation(properties);
|
||||
if (session->sessionGetTargetOrientationConfigInfoFunc_) {
|
||||
session->sessionGetTargetOrientationConfigInfoFunc_(static_cast<uint32_t>(targetOrientation));
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
}, __func__);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
WSError SceneSession::NotifyRotationProperty(int32_t rotation, uint32_t width, uint32_t height)
|
||||
{
|
||||
PostTask(
|
||||
[weakThis = wptr(this), rotation, width, height, where = __func__] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_ROTATION, "%{public}s session is null", where);
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
WSRect wsrect = { 0, 0, width, height };
|
||||
auto properties = session->GetSystemBarPropertyForRotation();
|
||||
std::map<AvoidAreaType, AvoidArea> avoidAreas;
|
||||
// session->GetAvoidAreasByRotation(rotation, wsrect, properties, avoidAreas); //
|
||||
// 此行代码依赖沉浸式,需要先注释
|
||||
if (!session->sessionStage_) {
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
Rect rect = { wsrect.posX_, wsrect.posY_, wsrect.width_, wsrect.height_ };
|
||||
OrientationInfo info = { rotation, rect, avoidAreas };
|
||||
session->sessionStage_->NotifyTargetRotationInfo(info);
|
||||
return WSError::WS_OK;
|
||||
}, __func__);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
void SceneSession::SetSystemBarPropertyForRotation(
|
||||
const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties)
|
||||
{
|
||||
targetSystemBarProperty_ = properties;
|
||||
}
|
||||
|
||||
std::map<Rosen::WindowType, Rosen::SystemBarProperty>& SceneSession::GetSystemBarPropertyForRotation()
|
||||
{
|
||||
return targetSystemBarProperty_;
|
||||
}
|
||||
|
||||
void SceneSession::AddRSNodeModifier(bool isDark, const std::shared_ptr<RSBaseNode>& rsNode)
|
||||
{
|
||||
if (!rsNode) {
|
||||
|
||||
@@ -140,8 +140,6 @@ public:
|
||||
WMError GetTargetOrientationConfigInfo(Orientation targetOrientation,
|
||||
const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties, Ace::ViewportConfig& config,
|
||||
std::map<AvoidAreaType, AvoidArea>& avoidAreas) override;
|
||||
Ace::ViewportConfig FillTargetOrientationConfig(
|
||||
OrientationInfo info, const sptr<DisplayInfo>& displayInfo, uint64_t displayId);
|
||||
WSError NotifyTargetRotationInfo(OrientationInfo& info) override;
|
||||
WSError UpdateDisplayId(uint64_t displayId) override;
|
||||
WMError AdjustKeyboardLayout(const KeyboardLayoutParams params) override;
|
||||
@@ -436,6 +434,12 @@ private:
|
||||
sptr<IWindowAttachStateChangeListner> windowAttachStateChangeListener_;
|
||||
WSError NotifyWindowAttachStateChange(bool isAttach) override;
|
||||
|
||||
/*
|
||||
* Window Rotation
|
||||
*/
|
||||
Ace::ViewportConfig FillTargetOrientationConfig(
|
||||
const OrientationInfo& info, const sptr<DisplayInfo>& displayInfo, uint64_t displayId);
|
||||
|
||||
/*
|
||||
* Window Lifecycle
|
||||
*/
|
||||
|
||||
@@ -139,7 +139,6 @@ public:
|
||||
WMError UnregisterPreferredOrientationChangeListener(
|
||||
const sptr<IPreferredOrientationChangeListener>& listener) override;
|
||||
void NotifyPreferredOrientationChange(Orientation orientation) override;
|
||||
void NotifyClientOrientationChange();
|
||||
WMError RegisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener>& listener) override;
|
||||
WMError UnregisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener>& listener) override;
|
||||
bool GetTouchable() const override;
|
||||
@@ -755,8 +754,8 @@ private:
|
||||
static std::map<int32_t, std::vector<sptr<IWindowStatusChangeListener>>> windowStatusChangeListeners_;
|
||||
static std::map<int32_t, std::vector<sptr<IWindowRectChangeListener>>> windowRectChangeListeners_;
|
||||
static std::map<int32_t, std::vector<sptr<ISwitchFreeMultiWindowListener>>> switchFreeMultiWindowListeners_;
|
||||
static std::map<int32_t, std::vector<sptr<IPreferredOrientationChangeListener>>> preferredOrientationChangeListener_;
|
||||
static std::map<int32_t, std::vector<sptr<IWindowOrientationChangeListener>>> windowOrientationChangeListener_;
|
||||
static std::map<int32_t, sptr<IPreferredOrientationChangeListener>> preferredOrientationChangeListener_;
|
||||
static std::map<int32_t, sptr<IWindowOrientationChangeListener>> windowOrientationChangeListener_;
|
||||
static std::map<int32_t, std::vector<sptr<IWindowHighlightChangeListener>>> highlightChangeListeners_;
|
||||
|
||||
// FA only
|
||||
@@ -835,6 +834,11 @@ private:
|
||||
*/
|
||||
WSError NotifyWindowAttachStateChange(bool isAttach) override { return WSError::WS_OK; }
|
||||
|
||||
/*
|
||||
* Window Rotation
|
||||
*/
|
||||
void NotifyClientOrientationChange();
|
||||
|
||||
/*
|
||||
* keyboard
|
||||
*/
|
||||
|
||||
@@ -2022,7 +2022,7 @@ WMError WindowSceneSessionImpl::GetTargetOrientationConfigInfo(Orientation targe
|
||||
}
|
||||
|
||||
Ace::ViewportConfig WindowSceneSessionImpl::FillTargetOrientationConfig(
|
||||
OrientationInfo info, const sptr<DisplayInfo>& displayInfo, uint64_t displayId)
|
||||
const OrientationInfo& info, const sptr<DisplayInfo>& displayInfo, uint64_t displayId)
|
||||
{
|
||||
Ace::ViewportConfig config;
|
||||
Rect targetRect = info.rect;
|
||||
|
||||
Reference in New Issue
Block a user