From c680dd6eeee61fc0404762cc307556d08896dbba Mon Sep 17 00:00:00 2001 From: LFRon Date: Tue, 7 Jul 2026 15:57:34 +0800 Subject: [PATCH] fix: issue caused by #948 If the surface was already mapped before the wrapper could connect tomappedChanged (e.g. wrapper created after the surface's initial map), onMappedChanged was never triggered. Make up for it here so that MappedOrSplash gets set and hasActiveCapability() can turn true,otherwise the window would be drawn but never activated/focused. --- src/surface/surfacewrapper.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/surface/surfacewrapper.cpp b/src/surface/surfacewrapper.cpp index b331e2711..dbdc156b9 100644 --- a/src/surface/surfacewrapper.cpp +++ b/src/surface/surfacewrapper.cpp @@ -2216,6 +2216,16 @@ void SurfaceWrapper::setHasInitializeContainer(bool value) // m_prelaunchSplash can't get mapped signal createNewOrClose(OPEN_ANIMATION); } + + // If the surface was already mapped before the wrapper could connect to + // mappedChanged (e.g. wrapper created after the surface's initial map), + // onMappedChanged was never triggered. Make up for it here so that + // MappedOrSplash gets set and hasActiveCapability() can turn true, + // otherwise the window would be drawn but never activated/focused. + if (!m_prelaunchSplash && value && surface() && surface()->mapped() + && !m_hasActiveCapability.testFlag(ActiveControlState::MappedOrSplash)) { + onMappedChanged(); + } } void SurfaceWrapper::disableWindowAnimation(bool disable)