From 9b05dc1b4c44849a3c23e67381dd7c2f311b4ee3 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 4 Apr 2026 19:07:39 +0100 Subject: [PATCH] render/decoration: cache input extents as well --- src/render/decorations/DecorationPositioner.cpp | 13 +++++-------- src/render/decorations/DecorationPositioner.hpp | 13 +++++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index 27da0f4ad..4c373925f 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -358,21 +358,18 @@ SBoxExtents CDecorationPositioner::computeWindowDecorationExtents(PHLWINDOWREF p } SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOWREF pWindow, bool inputOnly) { - // inputOnly is rare (input handling), skip the cache for it - if (inputOnly) - return computeWindowDecorationExtents(pWindow, true); - const auto WIT = std::ranges::find_if(m_windowDatas, [&](const auto& other) { return other.first.lock() == pWindow; }); if (WIT == m_windowDatas.end()) - return computeWindowDecorationExtents(pWindow, false); + return computeWindowDecorationExtents(pWindow, inputOnly); auto& wd = WIT->second; if (wd.needsDamageExtents) { - wd.decorationExtents = computeWindowDecorationExtents(pWindow, false); - wd.needsDamageExtents = false; + wd.decorationExtents = computeWindowDecorationExtents(pWindow, false); + wd.decorationInputExtents = computeWindowDecorationExtents(pWindow, true); + wd.needsDamageExtents = false; } - return wd.decorationExtents; + return inputOnly ? wd.decorationInputExtents : wd.decorationExtents; } CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) { diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp index ccd148dd2..99168c102 100644 --- a/src/render/decorations/DecorationPositioner.hpp +++ b/src/render/decorations/DecorationPositioner.hpp @@ -80,12 +80,13 @@ class CDecorationPositioner { }; struct SWindowData { - Vector2D lastWindowSize = {}; - SBoxExtents reserved = {}; - SBoxExtents extents = {}; - SBoxExtents decorationExtents = {}; - bool needsRecalc = false; - bool needsDamageExtents = true; + Vector2D lastWindowSize = {}; + SBoxExtents reserved = {}; + SBoxExtents extents = {}; + SBoxExtents decorationExtents = {}; + SBoxExtents decorationInputExtents = {}; + bool needsRecalc = false; + bool needsDamageExtents = true; }; std::map m_windowDatas;