diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp index 30ce8a8..4c4a9d5 100644 --- a/src/TabGroup.cpp +++ b/src/TabGroup.cpp @@ -273,12 +273,6 @@ void Hy3TabBar::tick() { if (this->entries.empty()) this->destroy = true; } -void Hy3TabBar::damage() { - auto pos = this->entries.front().node.position; - auto box = CBox {pos.x, pos.y, this->size.x, this->size.y}; - g_pHyprRenderer->damageBox(&box); -} - void Hy3TabBar::updateNodeList(std::list& nodes) { std::list::iterator> removed_entries; @@ -415,7 +409,17 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) { this->size.warp(); } +void Hy3TabGroup::damage() { + auto pos = this->node->position; + auto size = this->node->size; + auto box = CBox {pos.x, pos.y, size.x, size.y}; + + g_pHyprRenderer->damageBox(&box); +} + void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) { + this->node = &node; + static const auto gaps_in = ConfigValue("general:gaps_in"); static const auto gaps_out = ConfigValue("general:gaps_out"); static const auto bar_height = ConfigValue("plugin:hy3:tabs:height"); @@ -463,7 +467,7 @@ void Hy3TabGroup::tick() { } if (this->workspace->m_vRenderOffset.isBeingAnimated()) { - this->bar.damage(); + this->damage(); } } diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp index 5640958..910b304 100644 --- a/src/TabGroup.hpp +++ b/src/TabGroup.hpp @@ -67,7 +67,6 @@ public: Hy3TabBar(); void beginDestroy(); - void damage(); void tick(); void updateNodeList(std::list& nodes); void updateAnimations(bool warp = false); @@ -106,6 +105,7 @@ private: std::vector stencil_windows; Vector2D last_pos; Vector2D last_size; + Hy3Node* node; Hy3TabGroup(); @@ -114,4 +114,6 @@ private: // UB if node is not a group. void updateStencilWindows(Hy3Node&); + + void damage(); };