summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-05-22 22:06:40 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-05-22 22:06:40 +0200
commitd1ec314a03473124ffadf8dd8aea33c317dfc1d0 (patch)
treefd3b45ff2b10eabdb2075f540b9772f691e24ce9 /src
parent7bcc01efb7d6523ad573e54d9f80fc570f53cb89 (diff)
groupbars: conserve VRAM by staticizing textures
Diffstat (limited to 'src')
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.cpp12
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.hpp21
2 files changed, 19 insertions, 14 deletions
diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp
index c2a65f56..1db7952c 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.cpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.cpp
@@ -3,6 +3,11 @@
#include <ranges>
#include <pango/pangocairo.h>
+// shared things to conserve VRAM
+static std::deque<std::unique_ptr<CTitleTex>> m_dpTitleTextures;
+static CTexture m_tGradientActive;
+static CTexture m_tGradientInactive;
+
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) {
m_pWindow = pWindow;
}
@@ -166,8 +171,11 @@ void CHyprGroupBarDecoration::clearUnusedTextures() {
for (auto& tex : m_dpTitleTextures | std::views::reverse) {
bool found = false;
- for (auto& w : m_dwGroupMembers) {
- if (tex->szContent == w->m_szTitle && tex->pWindowOwner == w) {
+ for (auto& w : g_pCompositor->m_vWindows) {
+ if (!w->m_sGroupData.pNextWindow)
+ continue;
+
+ if (tex->szContent == w->m_szTitle && tex->pWindowOwner == w.get()) {
found = true;
break;
}
diff --git a/src/render/decorations/CHyprGroupBarDecoration.hpp b/src/render/decorations/CHyprGroupBarDecoration.hpp
index 3a0fec27..d8b0f46a 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.hpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.hpp
@@ -33,21 +33,18 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
private:
- SWindowDecorationExtents m_seExtents;
+ SWindowDecorationExtents m_seExtents;
- CWindow* m_pWindow = nullptr;
+ CWindow* m_pWindow = nullptr;
- Vector2D m_vLastWindowPos;
- Vector2D m_vLastWindowSize;
+ Vector2D m_vLastWindowPos;
+ Vector2D m_vLastWindowSize;
- std::deque<CWindow*> m_dwGroupMembers;
- std::deque<std::unique_ptr<CTitleTex>> m_dpTitleTextures;
+ std::deque<CWindow*> m_dwGroupMembers;
- CTitleTex* textureFromTitle(const std::string&);
- void clearUnusedTextures();
- void invalidateTextures();
+ CTitleTex* textureFromTitle(const std::string&);
+ void clearUnusedTextures();
+ void invalidateTextures();
- void refreshGradients();
- CTexture m_tGradientActive;
- CTexture m_tGradientInactive;
+ void refreshGradients();
}; \ No newline at end of file