From 160fe1dda5521961d317e8dcf5d71d60fc071a0d Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Thu, 21 Mar 2024 23:13:48 -0700 Subject: [PATCH] layout: fix maximize failing for workspaces with no tiled windows --- CHANGELOG.md | 3 +++ src/Hy3Layout.cpp | 7 ++++--- src/TabGroup.cpp | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ad188b..42aea67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Upcoming +- Fixed fullscreen not working on workspaces with only floating windows + ## hl0.36.0 and before - Implement `resizeactivewindow` for floating windows diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 2b0fb0f..c4208d8 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -1092,7 +1092,9 @@ Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) { for (auto& tab: tab_bar.bar.entries) { if (child_iter == children.end()) break; - if (x > tab.offset.value() * size.x && x < (tab.offset.value() + tab.width.value()) * size.x) { + if (x > tab.offset.value() * size.x + && x < (tab.offset.value() + tab.width.value()) * size.x) + { *focused_node = *child_iter; return &node; } @@ -1448,7 +1450,6 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { if (node->data.type != Hy3NodeType::Window) return; auto* window = node->data.as_window; auto root_node = this->getWorkspaceRootGroup(window->m_iWorkspaceID); - if (root_node == nullptr) return; CMonitor* monitor = nullptr; @@ -1496,7 +1497,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { window->m_vSize = node->size; window->m_vPosition = node->position; - auto only_node = root_node->data.as_group.children.size() == 1 + auto only_node = root_node != nullptr && root_node->data.as_group.children.size() == 1 && root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window; if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID) diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp index d400f04..5483683 100644 --- a/src/TabGroup.cpp +++ b/src/TabGroup.cpp @@ -390,7 +390,7 @@ void Hy3TabBar::updateAnimations(bool warp) { while (entry != this->entries.end()) { if (warp) { if (entry->width.goal() == 0.0) { - //this->entries.erase(entry++); + // this->entries.erase(entry++); entry = std::next(entry); continue; } @@ -605,8 +605,8 @@ void Hy3TabGroup::renderTabBar() { Vector2D entry_pos = { (pos.x + (entry.offset.value() * size.x) + (*padding * 0.5)) * scale, scaled_pos.y - + ((entry.vertical_pos.value() * (size.y + *padding) * scale) * (*enter_from_top ? -1 : 1) - ), + + ((entry.vertical_pos.value() * (size.y + *padding) * scale) + * (*enter_from_top ? -1 : 1)), }; Vector2D entry_size = {((entry.width.value() * size.x) - *padding) * scale, scaled_size.y}; if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return;