Fix tab bars with multiple monitors

This commit is contained in:
outfoxxed 2023-05-30 01:45:48 -07:00
parent 90b50d5b1a
commit 8e69c390c7
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
2 changed files with 6 additions and 5 deletions

View file

@ -1618,14 +1618,15 @@ void Hy3Layout::renderHook(void*, std::any data) {
auto& tab_groups = g_Hy3Layout->tab_groups; auto& tab_groups = g_Hy3Layout->tab_groups;
auto entry = tab_groups.begin(); auto entry = tab_groups.begin();
while (entry != tab_groups.end()) { while (entry != tab_groups.end()) {
if (std::find(rendered_groups.begin(), rendered_groups.end(), &*entry) == rendered_groups.end()) { if (entry->target_window->m_iMonitorID == g_pHyprOpenGL->m_RenderData.pMonitor->ID
&& std::find(rendered_groups.begin(), rendered_groups.end(), &*entry) == rendered_groups.end()
) {
entry->renderTabBar(); entry->renderTabBar();
if (entry->bar.destroy) tab_groups.erase(entry++); if (entry->bar.destroy) tab_groups.erase(entry++);
} }
entry = std::next(entry); entry = std::next(entry);
} }
} break; } break;
default: default:
break; break;

View file

@ -288,7 +288,7 @@ void Hy3TabGroup::renderTabBar() {
auto* monitor = g_pHyprOpenGL->m_RenderData.pMonitor; auto* monitor = g_pHyprOpenGL->m_RenderData.pMonitor;
auto scale = monitor->scale; auto scale = monitor->scale;
auto pos = this->pos.vec(); auto pos = this->pos.vec() - monitor->vecPosition;
auto size = this->size.vec(); auto size = this->size.vec();
pos.y += (this->bar.vertical_pos.fl() * size.y) * (*enter_from_top ? -1 : 1); pos.y += (this->bar.vertical_pos.fl() * size.y) * (*enter_from_top ? -1 : 1);
@ -331,7 +331,7 @@ void Hy3TabGroup::renderTabBar() {
for (auto* window: this->stencil_windows) { for (auto* window: this->stencil_windows) {
if (!g_pCompositor->windowExists(window)) continue; if (!g_pCompositor->windowExists(window)) continue;
auto wpos = window->m_vRealPosition.vec(); auto wpos = window->m_vRealPosition.vec() - monitor->vecPosition;
auto wsize = window->m_vRealSize.vec(); auto wsize = window->m_vRealSize.vec();
wlr_box window_box = { wpos.x, wpos.y, wsize.x, wsize.y }; wlr_box window_box = { wpos.x, wpos.y, wsize.x, wsize.y };