8e69c390c791c52db648c453a782e87f06c09bf0

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

Message

Fix tab bars with multiple monitors

Diff

 1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 2index 176fd8a3adcc9d3121617293b45fccde05ac8968..831f02ce75796b2a6db514d7e282450e6e04f461 100644
 3--- a/src/Hy3Layout.cpp
 4+++ b/src/Hy3Layout.cpp
 5@@ -1618,14 +1618,15 @@ void Hy3Layout::renderHook(void*, std::any data) {
 6 		auto& tab_groups = g_Hy3Layout->tab_groups;
 7 		auto entry = tab_groups.begin();
 8 		while (entry != tab_groups.end()) {
 9-			if (std::find(rendered_groups.begin(), rendered_groups.end(), &*entry) == rendered_groups.end()) {
10+			if (entry->target_window->m_iMonitorID == g_pHyprOpenGL->m_RenderData.pMonitor->ID
11+					&& std::find(rendered_groups.begin(), rendered_groups.end(), &*entry) == rendered_groups.end()
12+			) {
13 				entry->renderTabBar();
14 				if (entry->bar.destroy) tab_groups.erase(entry++);
15 			}
16 
17 			entry = std::next(entry);
18-		}
19-
20+			}
21 	} break;
22 	default:
23 		break;
24diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
25index a2403d0904e58f93da530b4787da28f9b54e017a..b9eb99e26073fcbfaa052abb8244532262f0f7a4 100644
26--- a/src/TabGroup.cpp
27+++ b/src/TabGroup.cpp
28@@ -288,7 +288,7 @@ void Hy3TabGroup::renderTabBar() {
29 	auto* monitor = g_pHyprOpenGL->m_RenderData.pMonitor;
30 	auto scale = monitor->scale;
31 
32-	auto pos = this->pos.vec();
33+	auto pos = this->pos.vec() - monitor->vecPosition;
34 	auto size = this->size.vec();
35 	pos.y += (this->bar.vertical_pos.fl() * size.y) * (*enter_from_top ? -1 : 1);
36 
37@@ -331,7 +331,7 @@ void Hy3TabGroup::renderTabBar() {
38 		for (auto* window: this->stencil_windows) {
39 			if (!g_pCompositor->windowExists(window)) continue;
40 
41-			auto wpos = window->m_vRealPosition.vec();
42+			auto wpos = window->m_vRealPosition.vec() - monitor->vecPosition;
43 			auto wsize = window->m_vRealSize.vec();
44 
45 			wlr_box window_box = { wpos.x, wpos.y, wsize.x, wsize.y };