160fe1dda5521961d317e8dcf5d71d60fc071a0d

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

Message

layout: fix maximize failing for workspaces with no tiled windows

Diff

 1diff --git a/CHANGELOG.md b/CHANGELOG.md
 2index 3ad188b0cb80cdb36fdc2613481e8fe3c6657000..42aea670d1cf4dce7566847efb1c1ba08172576b 100644
 3--- a/CHANGELOG.md
 4+++ b/CHANGELOG.md
 5@@ -1,5 +1,8 @@
 6 # Changelog
 7 
 8+## Upcoming
 9+- Fixed fullscreen not working on workspaces with only floating windows
10+
11 ## hl0.36.0 and before
12 
13 - Implement `resizeactivewindow` for floating windows
14diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
15index 2b0fb0f8cfd2732405e1d8241d9e8c5775077989..c4208d8e2ad8bbd20c804589a177d0cf6a6588b8 100644
16--- a/src/Hy3Layout.cpp
17+++ b/src/Hy3Layout.cpp
18@@ -1092,7 +1092,9 @@ Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) {
19 				for (auto& tab: tab_bar.bar.entries) {
20 					if (child_iter == children.end()) break;
21 
22-					if (x > tab.offset.value() * size.x && x < (tab.offset.value() + tab.width.value()) * size.x) {
23+					if (x > tab.offset.value() * size.x
24+					    && x < (tab.offset.value() + tab.width.value()) * size.x)
25+					{
26 						*focused_node = *child_iter;
27 						return &node;
28 					}
29@@ -1448,7 +1450,6 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
30 	if (node->data.type != Hy3NodeType::Window) return;
31 	auto* window = node->data.as_window;
32 	auto root_node = this->getWorkspaceRootGroup(window->m_iWorkspaceID);
33-	if (root_node == nullptr) return;
34 
35 	CMonitor* monitor = nullptr;
36 
37@@ -1496,7 +1497,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
38 	window->m_vSize = node->size;
39 	window->m_vPosition = node->position;
40 
41-	auto only_node = root_node->data.as_group.children.size() == 1
42+	auto only_node = root_node != nullptr && root_node->data.as_group.children.size() == 1
43 	              && root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window;
44 
45 	if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID)
46diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
47index d400f04d9ab5d02ce8ea037f772bee265779a72b..54836838308dcee09e80f802b781677898b81a68 100644
48--- a/src/TabGroup.cpp
49+++ b/src/TabGroup.cpp
50@@ -390,7 +390,7 @@ void Hy3TabBar::updateAnimations(bool warp) {
51 	while (entry != this->entries.end()) {
52 		if (warp) {
53 			if (entry->width.goal() == 0.0) {
54-				//this->entries.erase(entry++);
55+				// this->entries.erase(entry++);
56 				entry = std::next(entry);
57 				continue;
58 			}
59@@ -605,8 +605,8 @@ void Hy3TabGroup::renderTabBar() {
60 		Vector2D entry_pos = {
61 		    (pos.x + (entry.offset.value() * size.x) + (*padding * 0.5)) * scale,
62 		    scaled_pos.y
63-		        + ((entry.vertical_pos.value() * (size.y + *padding) * scale) * (*enter_from_top ? -1 : 1)
64-		        ),
65+		        + ((entry.vertical_pos.value() * (size.y + *padding) * scale)
66+		           * (*enter_from_top ? -1 : 1)),
67 		};
68 		Vector2D entry_size = {((entry.width.value() * size.x) - *padding) * scale, scaled_size.y};
69 		if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return;