11fcce578038798da2aa39ca5dfb33fca0f4a22e

Author
Šimon Brandner <simon.bra.ag@gmail.com>
Committer
Šimon Brandner <simon.bra.ag@gmail.com>
Date

Message

Damage the whole node when animating slide

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

Diff

 1diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 2index 30ce8a8c86977dd04792d9e166ca1898f74fe7dd..4c4a9d5d9347805f6076f17acb70801bb44d3a53 100644
 3--- a/src/TabGroup.cpp
 4+++ b/src/TabGroup.cpp
 5@@ -273,12 +273,6 @@ void Hy3TabBar::tick() {
 6 	if (this->entries.empty()) this->destroy = true;
 7 }
 8 
 9-void Hy3TabBar::damage() {
10-	auto pos = this->entries.front().node.position;
11-	auto box = CBox {pos.x, pos.y, this->size.x, this->size.y};
12-	g_pHyprRenderer->damageBox(&box);
13-}
14-
15 void Hy3TabBar::updateNodeList(std::list<Hy3Node*>& nodes) {
16 	std::list<std::list<Hy3TabBarEntry>::iterator> removed_entries;
17 
18@@ -415,7 +409,17 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
19 	this->size.warp();
20 }
21 
22+void Hy3TabGroup::damage() {
23+	auto pos = this->node->position;
24+	auto size = this->node->size;
25+	auto box = CBox {pos.x, pos.y, size.x, size.y};
26+
27+	g_pHyprRenderer->damageBox(&box);
28+}
29+
30 void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
31+	this->node = &node;
32+
33 	static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
34 	static const auto gaps_out = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_out");
35 	static const auto bar_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:height");
36@@ -463,7 +467,7 @@ void Hy3TabGroup::tick() {
37 		}
38 
39 		if (this->workspace->m_vRenderOffset.isBeingAnimated()) {
40-			this->bar.damage();
41+			this->damage();
42 		}
43 	}
44 
45diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
46index 5640958078c8828e9b29eb6451cca1d7a812da14..910b304b7ed3b1d24891da9b001f1872d251bbf2 100644
47--- a/src/TabGroup.hpp
48+++ b/src/TabGroup.hpp
49@@ -67,7 +67,6 @@ public:
50 	Hy3TabBar();
51 	void beginDestroy();
52 
53-	void damage();
54 	void tick();
55 	void updateNodeList(std::list<Hy3Node*>& nodes);
56 	void updateAnimations(bool warp = false);
57@@ -106,6 +105,7 @@ private:
58 	std::vector<PHLWINDOWREF> stencil_windows;
59 	Vector2D last_pos;
60 	Vector2D last_size;
61+	Hy3Node* node;
62 
63 	Hy3TabGroup();
64 
65@@ -114,4 +114,6 @@ private:
66 
67 	// UB if node is not a group.
68 	void updateStencilWindows(Hy3Node&);
69+
70+	void damage();
71 };