From 3b6a59e7f163b2d2f8a07ae187b392f71b074cc4 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Sun, 14 Dec 2025 20:46:18 +0800 Subject: Use infinite size for 0 size window. --- src/ui/controls/ControlHost.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui/controls') diff --git a/src/ui/controls/ControlHost.cpp b/src/ui/controls/ControlHost.cpp index 290602d4..178e2ca3 100644 --- a/src/ui/controls/ControlHost.cpp +++ b/src/ui/controls/ControlHost.cpp @@ -1,5 +1,6 @@ #include "cru/ui/controls/ControlHost.h" +#include "cru/base/log/Logger.h" #include "cru/platform/gui/UiApplication.h" #include "cru/platform/gui/Window.h" #include "cru/ui/Base.h" @@ -151,7 +152,11 @@ void ControlHost::Repaint() { } void ControlHost::Relayout() { - RelayoutWithSize(native_window_->GetClientSize()); + auto size = native_window_->GetClientSize(); + if (size.width == 0.f && size.height == 0.f) { + size = Size::Infinite(); + } + RelayoutWithSize(size); } void ControlHost::RelayoutWithSize(const Size& available_size, @@ -259,6 +264,7 @@ void ControlHost::OnNativePaint1( } void ControlHost::OnNativeResize([[maybe_unused]] const Size& size) { + CruLogDebug(kLogTag, "Window resize to {}.", size); ScheduleRelayout(); } -- cgit v1.2.3