summaryrefslogtreecommitdiff
path: root/src/render/decorations/DecorationPositioner.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-10-27 18:51:26 +0100
committerGitHub <noreply@github.com>2024-10-27 17:51:26 +0000
commitf9b52203f58bcb716144d89ee9f85fe12ebfe94d (patch)
tree4ecf23106134d32a5411a185d7081f986cd0c33c /src/render/decorations/DecorationPositioner.cpp
parenta3d3b4fd64a51a8c1663b450bd2a408f1f0fa9b3 (diff)
internal: optimize cursor move a bit (#8264)
* window: inline and const getWindowMainSurfaceBox getWindowMainSurfaceBox gets called a lot of times from deep down from mousemoveunified, profiling mousemoveunified it spends quite a lot of cpu time in here, let the compiler optimize the call to getWindowMainSurfaceBox by inlining and making it const. reducing the overhead. * inputmgr: return early and use std::any_of return early in mousemoveunified to reduce the amount of unnecessery calls to various pointers when not needed, also make isconstrained use std::any_of instead of for loop to use the STL optimized paths with hopes and dreams marginally faster. * decoration: return early, reduce temporar copy return earlier and reduce the temp copies by using one .lock instead of two
Diffstat (limited to 'src/render/decorations/DecorationPositioner.cpp')
-rw-r--r--src/render/decorations/DecorationPositioner.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp
index 4666a59e..3eb45546 100644
--- a/src/render/decorations/DecorationPositioner.cpp
+++ b/src/render/decorations/DecorationPositioner.cpp
@@ -297,13 +297,14 @@ SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOW pWindow,
CBox accum = pWindow->getWindowMainSurfaceBox();
for (auto const& data : m_vWindowPositioningDatas) {
- if (data->pWindow.lock() != pWindow)
+ if (!data->pDecoration)
continue;
- if (!data->pWindow.lock() || !data->pDecoration)
+ if (!(data->pDecoration->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT) && inputOnly)
continue;
- if (!(data->pDecoration->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT) && inputOnly)
+ auto const window = data->pWindow.lock();
+ if (!window || window != pWindow)
continue;
CBox decoBox;
@@ -373,9 +374,10 @@ CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) {
}
CBox CDecorationPositioner::getWindowDecorationBox(IHyprWindowDecoration* deco) {
- const auto DATA = getDataFor(deco, deco->m_pWindow.lock());
+ auto const window = deco->m_pWindow.lock();
+ const auto DATA = getDataFor(deco, window);
CBox box = DATA->lastReply.assignedGeometry;
- box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, deco->m_pWindow.lock()));
+ box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, window));
return box;
}