f34775d4ee1ca0720d09d09b190b33ffda4db064

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

Message

fix tab bar stencil rendering and damage

Diff

This diff is truncated to protect this page.

  1diff --git a/CHANGELOG.md b/CHANGELOG.md
  2index f931c4cfe4fbbe450b813018b1552a1a3d84d833..79a52539c548f0a386dc87636377eaf2e6900154 100644
  3--- a/CHANGELOG.md
  4+++ b/CHANGELOG.md
  5@@ -1,5 +1,9 @@
  6 # Changelog
  7 
  8+# Upcoming
  9+
 10+- Fixed tab bar stencil and damage rendering
 11+
 12 # hl0.53.0 and before
 13 
 14 - Fixed tab bar not being damaged (glitching) on window title change.
 15diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 16index d0042f5ddd9e39dc13a33f801634af6c34cfecef..9bf79212dba48a003ffcb3a2a3ff5fefcd30775d 100644
 17--- a/src/TabGroup.cpp
 18+++ b/src/TabGroup.cpp
 19@@ -641,11 +641,12 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
 20 	if (this->bar.dirty) this->tick();
 21 }
 22 
 23-void damageBox(const Vector2D* position, const Vector2D* size) {
 24+void Hy3TabBar::damageBox(const Vector2D* position, const Vector2D* size) {
 25 	auto box = CBox {position->x, position->y, size->x, size->y};
 26 	// Either a rounding error or an issue below makes this necessary.
 27 	box.expand(1);
 28 	g_pHyprRenderer->damageBox(box);
 29+	this->damaged = true;
 30 }
 31 
 32 void Hy3TabGroup::tick() {
 33@@ -681,22 +682,21 @@ void Hy3TabGroup::tick() {
 34 			// tick, cleaning up after ourselves
 35 			auto pos = this->last_pos + this->last_workspace_offset;
 36 			auto size = this->last_size;
 37-			damageBox(&pos, &size);
 38+			this->bar.damageBox(&pos, &size);
 39 
 40 			// Then we damage the current position of the bar, to avoid seeing
 41 			// glitches with animations disabled
 42 			pos = this->pos->value() + workspaceOffset;
 43 			size = this->size->value();
 44-			damageBox(&pos, &size);
 45+			this->bar.damageBox(&pos, &size);
 46 
 47-			this->bar.damaged = true;
 48 			this->last_workspace_offset = workspaceOffset;
 49 		}
 50 
 51 		if (this->workspace->m_alpha->isBeingAnimated()) {
 52 			auto pos = this->pos->value();
 53 			auto size = this->size->value();
 54-			damageBox(&pos, &size);
 55+			this->bar.damageBox(&pos, &size);
 56 		}
 57 	}
 58 
 59@@ -704,9 +704,7 @@ void Hy3TabGroup::tick() {
 60 	auto size = this->size->value();
 61 
 62 	if (this->last_pos != pos || this->last_size != size) {
 63-		damageBox(&this->last_pos, &this->last_size);
 64-
 65-		this->bar.damaged = true;
 66+		this->bar.damageBox(&this->last_pos, &this->last_size);
 67 		this->last_pos = pos;
 68 		this->last_size = size;
 69 	}
 70@@ -718,9 +716,7 @@ void Hy3TabGroup::tick() {
 71 			pos.y -= *padding;
 72 		}
 73 
 74-		damageBox(&pos, &size);
 75-
 76-		this->bar.damaged = true;
 77+		this->bar.damageBox(&pos, &size);
 78 		this->bar.dirty = false;
 79 	}
 80 }
 81@@ -787,10 +783,11 @@ void Hy3TabGroup::renderTabBar() {
 82 	}
 83 
 84 	if (render_stencil) {
 85+		g_pHyprOpenGL->m_renderData.currentFB->bind();
 86 		glEnable(GL_STENCIL_TEST);
 87+		glStencilMask(0xff);
 88 		glClearStencil(0);
 89 		glClear(GL_STENCIL_BUFFER_BIT);
 90-		glStencilMask(0xff);
 91 		glStencilFunc(GL_ALWAYS, 1, 0xff);
 92 		glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
 93 
 94@@ -807,11 +804,14 @@ void Hy3TabGroup::renderTabBar() {
 95 			auto wsize = window->m_realSize->value();
 96 
 97 			CBox window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
 98+			auto border = window->getRealBorderSize();
 99+			auto radius = *window_rounding + border;
100+			window_box.expand(border);
101 			// scaleBox(&window_box, scale);
102 			window_box.scale(scale);
103 
104 			if (window_box.width > 0 && window_box.height > 0)
105-				g_pHyprOpenGL->renderRect(window_box, CHyprColor(0, 0, 0, 0), { .round = *window_rounding });
106+				g_pHyprOpenGL->renderRect(window_box, CHyprColor(0, 0, 0, 0), { .round = radius });
107 		}
108 
109 		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
110@@ -857,9 +857,9 @@ void Hy3TabGroup::renderTabBar() {
111 
112 	if (render_stencil) {
113 		glClearStencil(0);
114+		glStencilMask(0xff);
115 		glClear(GL_STENCIL_BUFFER_BIT);
116 		glDisable(GL_STENCIL_TEST);
117-		glStencilMask(0xff);
118 		glStencilFunc(GL_ALWAYS, 1, 0xff);
119diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
120index 1888f9051850107a15751f727b42ba4fb3c4a2af..216396a1dcb87e4890fd5f36809bbd1cb5330129 100644
121--- a/src/TabGroup.hpp
122+++ b/src/TabGroup.hpp
123@@ -85,6 +85,7 @@ public:
124 
125 	Hy3TabBar();
126 	void beginDestroy();
127+	void damageBox(const Vector2D* position, const Vector2D* size);
128 
129 	void tick();
130 	void updateNodeList(std::list<Hy3Node*>& nodes);