mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 06:25:58 +01:00
groupbars: conserve VRAM by staticizing textures
This commit is contained in:
parent
7bcc01efb7
commit
d1ec314a03
2 changed files with 19 additions and 14 deletions
|
@ -3,6 +3,11 @@
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <pango/pangocairo.h>
|
#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) {
|
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) {
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
}
|
}
|
||||||
|
@ -166,8 +171,11 @@ void CHyprGroupBarDecoration::clearUnusedTextures() {
|
||||||
for (auto& tex : m_dpTitleTextures | std::views::reverse) {
|
for (auto& tex : m_dpTitleTextures | std::views::reverse) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (auto& w : m_dwGroupMembers) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (tex->szContent == w->m_szTitle && tex->pWindowOwner == w) {
|
if (!w->m_sGroupData.pNextWindow)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (tex->szContent == w->m_szTitle && tex->pWindowOwner == w.get()) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,10 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
||||||
Vector2D m_vLastWindowSize;
|
Vector2D m_vLastWindowSize;
|
||||||
|
|
||||||
std::deque<CWindow*> m_dwGroupMembers;
|
std::deque<CWindow*> m_dwGroupMembers;
|
||||||
std::deque<std::unique_ptr<CTitleTex>> m_dpTitleTextures;
|
|
||||||
|
|
||||||
CTitleTex* textureFromTitle(const std::string&);
|
CTitleTex* textureFromTitle(const std::string&);
|
||||||
void clearUnusedTextures();
|
void clearUnusedTextures();
|
||||||
void invalidateTextures();
|
void invalidateTextures();
|
||||||
|
|
||||||
void refreshGradients();
|
void refreshGradients();
|
||||||
CTexture m_tGradientActive;
|
|
||||||
CTexture m_tGradientInactive;
|
|
||||||
};
|
};
|
Loading…
Reference in a new issue