mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 16:38:38 +02:00
render/decoration: cache input extents as well
This commit is contained in:
parent
d170a627b5
commit
9b05dc1b4c
2 changed files with 12 additions and 14 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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<PHLWINDOWREF, SWindowData> m_windowDatas;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue