9885ef2b9291ea6a74d36f8a0480d7e1f22e29d0

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

disabled tab bar stencil when not required

Diff

 1diff --git a/CHANGELOG.md b/CHANGELOG.md
 2index a6adf34edd5fea14e4b4ad6410ab0f47fa7d19ef..79be948076bef39b01666888f85048ae9205867f 100644
 3--- a/CHANGELOG.md
 4+++ b/CHANGELOG.md
 5@@ -4,6 +4,7 @@
 6 
 7 - Fixed tab bars on root node not respecting outer gaps
 8 - Fixed tab bars clipping when switching workspaces with slidevert
 9+- Improved performance of tab bars
10 
11 # hl0.43.0 and before
12 
13diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
14index 66c8623afe7070802478167bca5f1afd69414029..6ae38df5d797ae02146fa6c8d22349d683082f95 100644
15--- a/src/TabGroup.cpp
16+++ b/src/TabGroup.cpp
17@@ -555,7 +555,18 @@ void Hy3TabGroup::renderTabBar() {
18 
19 	this->bar.setSize(scaled_size);
20 
21-	{
22+	auto render_stencil = this->bar.fade_opacity.isBeingAnimated();
23+
24+	if (!render_stencil) {
25+		for (auto& entry: this->bar.entries) {
26+			if (entry.vertical_pos.isBeingAnimated()) {
27+				render_stencil = true;
28+				break;
29+			}
30+		}
31+	}
32+
33+	if (render_stencil) {
34 		glEnable(GL_STENCIL_TEST);
35 		glClearStencil(0);
36 		glClear(GL_STENCIL_BUFFER_BIT);
37@@ -624,7 +635,7 @@ void Hy3TabGroup::renderTabBar() {
38 		render_entry(entry);
39 	}
40 
41-	{
42+	if (render_stencil) {
43 		glClearStencil(0);
44 		glClear(GL_STENCIL_BUFFER_BIT);
45 		glDisable(GL_STENCIL_TEST);