mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
!10909 fix blank for size changed
Merge pull request !10909 from Laiganlu/hop
This commit is contained in:
commit
3bebd1a69e
@ -566,6 +566,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Window Layout
|
* Window Layout
|
||||||
*/
|
*/
|
||||||
|
std::atomic_bool windowSizeChanged_ = false;
|
||||||
WSRect layoutRect_;
|
WSRect layoutRect_;
|
||||||
std::atomic_bool enableFrameLayoutFinishCb_ = false;
|
std::atomic_bool enableFrameLayoutFinishCb_ = false;
|
||||||
WindowSizeChangeReason lastSizeChangeReason_ = WindowSizeChangeReason::END;
|
WindowSizeChangeReason lastSizeChangeReason_ = WindowSizeChangeReason::END;
|
||||||
|
@ -683,6 +683,9 @@ WSError WindowSessionImpl::UpdateRect(const WSRect& rect, SizeChangeReason reaso
|
|||||||
Rect wmRect = { rect.posX_, rect.posY_, rect.width_, rect.height_ };
|
Rect wmRect = { rect.posX_, rect.posY_, rect.width_, rect.height_ };
|
||||||
auto preRect = GetRect();
|
auto preRect = GetRect();
|
||||||
property_->SetWindowRect(wmRect);
|
property_->SetWindowRect(wmRect);
|
||||||
|
if (preRect.width_ != wmRect.width_ || preRect.height_ != wmRect.height_) {
|
||||||
|
windowSizeChanged_ = true;
|
||||||
|
}
|
||||||
property_->SetRequestRect(wmRect);
|
property_->SetRequestRect(wmRect);
|
||||||
|
|
||||||
TLOGI(WmsLogTag::WMS_LAYOUT, "%{public}s, preRect:%{public}s, reason:%{public}u, hasRSTransaction:%{public}d"
|
TLOGI(WmsLogTag::WMS_LAYOUT, "%{public}s, preRect:%{public}s, reason:%{public}u, hasRSTransaction:%{public}d"
|
||||||
@ -859,7 +862,7 @@ void WindowSessionImpl::FlushLayoutSize(int32_t width, int32_t height)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WSRect rect = { 0, 0, width, height };
|
WSRect rect = { 0, 0, width, height };
|
||||||
if (layoutRect_ != rect || enableFrameLayoutFinishCb_) {
|
if (windowSizeChanged_ || layoutRect_ != rect || enableFrameLayoutFinishCb_) {
|
||||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER,
|
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER,
|
||||||
"NotifyFrameLayoutFinishFromApp, id: %u, rect: %s, notifyListener: %d",
|
"NotifyFrameLayoutFinishFromApp, id: %u, rect: %s, notifyListener: %d",
|
||||||
GetWindowId(), rect.ToString().c_str(), enableFrameLayoutFinishCb_.load());
|
GetWindowId(), rect.ToString().c_str(), enableFrameLayoutFinishCb_.load());
|
||||||
@ -869,6 +872,7 @@ void WindowSessionImpl::FlushLayoutSize(int32_t width, int32_t height)
|
|||||||
if (auto session = GetHostSession()) {
|
if (auto session = GetHostSession()) {
|
||||||
session->NotifyFrameLayoutFinishFromApp(enableFrameLayoutFinishCb_, rect);
|
session->NotifyFrameLayoutFinishFromApp(enableFrameLayoutFinishCb_, rect);
|
||||||
}
|
}
|
||||||
|
windowSizeChanged_ = false;
|
||||||
layoutRect_ = rect;
|
layoutRect_ = rect;
|
||||||
enableFrameLayoutFinishCb_ = false;
|
enableFrameLayoutFinishCb_ = false;
|
||||||
}
|
}
|
||||||
|
@ -2177,6 +2177,40 @@ HWTEST_F(WindowSessionImplTest4, ClearListenersById_switchFreeMultiWindowListene
|
|||||||
|
|
||||||
GTEST_LOG_(INFO) << "WindowSessionImplTest4: ClearListenersById_switchFreeMultiWindowListeners end";
|
GTEST_LOG_(INFO) << "WindowSessionImplTest4: ClearListenersById_switchFreeMultiWindowListeners end";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.name: FlushLayoutSize
|
||||||
|
* @tc.desc: FlushLayoutSize
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
HWTEST_F(WindowSessionImplTest4, FlushLayoutSize, Function | SmallTest | Level2)
|
||||||
|
{
|
||||||
|
#undef private
|
||||||
|
GTEST_LOG_(INFO) << "WindowSessionImplTest4: FlushLayoutSize start";
|
||||||
|
sptr<WindowOption> option_ = sptr<WindowOption>::MakeSptr();
|
||||||
|
option_->SetWindowName("FlushLayoutSize");
|
||||||
|
sptr<WindowSessionImpl> window_ = sptr<WindowSessionImpl>::MakeSptr(option_);
|
||||||
|
window_->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||||
|
int32_t width = 1320;
|
||||||
|
int32_t height = 2710;
|
||||||
|
WSRect rect = { 0, 0, width, height };
|
||||||
|
window_->FlushLayoutSize(width, height);
|
||||||
|
|
||||||
|
window_->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
|
||||||
|
window_->windowSizeChanged_ = true;
|
||||||
|
window_->FlushLayoutSize(width, height);
|
||||||
|
ASSERT_EQ(window_->windowSizeChanged_, false);
|
||||||
|
|
||||||
|
window_->layoutRect_ = { 0, 0, 2710, 1320 };
|
||||||
|
window_->FlushLayoutSize(width, height);
|
||||||
|
ASSERT_EQ(window_->layoutRect_, rect);
|
||||||
|
|
||||||
|
window_->enableFrameLayoutFinishCb_ = true;
|
||||||
|
window_->FlushLayoutSize(width, height);
|
||||||
|
ASSERT_EQ(window_->windowSizeChanged_, false);
|
||||||
|
|
||||||
|
GTEST_LOG_(INFO) << "WindowSessionImplTest4: FlushLayoutSize end";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace Rosen
|
} // namespace Rosen
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
Loading…
Reference in New Issue
Block a user