a392bfd13caf865ccf6b9df6917b67cc3a054b82

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

Message

Fix breakage after hyprland#4911

Diff

This diff is truncated to protect this page.

  1diff --git a/flake.lock b/flake.lock
  2index c450cf52e1dc46dbe5480b8b420e56af65a52e91..cbaba3e4c1adecd0a9372b6df2cccff8a53ca3bd 100644
  3--- a/flake.lock
  4+++ b/flake.lock
  5@@ -10,13 +10,12 @@
  6         "xdph": "xdph"
  7       },
  8       "locked": {
  9-        "lastModified": 1709080360,
 10-        "narHash": "sha256-oZe4k6jtO/0govmERGcbeyvE9EfTvXY5bnyIs6AsL9U=",
 11-        "ref": "v0.36.0",
 12-        "rev": "1c460e98f870676b15871fe4e5bfeb1a32a3d6d8",
 13-        "revCount": 4102,
 14-        "type": "git",
 15-        "url": "file:///home/admin/programming/outfoxxed/hyprland/Hyprland"
 16+        "lastModified": 1709339717,
 17+        "narHash": "sha256-VXh6tiY1+Tmaz+dgUNE5IpWaFq4wbf/iCTHclGm33vA=",
 18+        "owner": "hyprwm",
 19+        "repo": "Hyprland",
 20+        "rev": "b2c34404777ea0850f90f4c38f64484f03599d14",
 21+        "type": "github"
 22       },
 23       "original": {
 24         "owner": "hyprwm",
 25diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 26index 14b3c9be9fad2e7f9a1cdd026f00fd500b819432..2b0fb0f8cfd2732405e1d8241d9e8c5775077989 100644
 27--- a/src/Hy3Layout.cpp
 28+++ b/src/Hy3Layout.cpp
 29@@ -487,8 +487,8 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, eRectCorner corner, CW
 30 	} else if (window->m_bIsFloating) {
 31 		// No parent node - is this a floating window?  If so, use the same logic as the `main` layout
 32 		const auto required_size = Vector2D(
 33-		    std::max((window->m_vRealSize.goalv() + delta).x, 20.0),
 34-		    std::max((window->m_vRealSize.goalv() + delta).y, 20.0)
 35+		    std::max((window->m_vRealSize.goal() + delta).x, 20.0),
 36+		    std::max((window->m_vRealSize.goal() + delta).y, 20.0)
 37 		);
 38 		window->m_vRealSize = required_size;
 39 	}
 40@@ -530,10 +530,10 @@ void Hy3Layout::fullscreenRequestForWindow(
 41 
 42 		// save position and size if floating
 43 		if (window->m_bIsFloating) {
 44-			window->m_vLastFloatingPosition = window->m_vRealPosition.goalv();
 45-			window->m_vPosition = window->m_vRealPosition.goalv();
 46-			window->m_vLastFloatingSize = window->m_vRealSize.goalv();
 47-			window->m_vSize = window->m_vRealSize.goalv();
 48+			window->m_vLastFloatingPosition = window->m_vRealPosition.goal();
 49+			window->m_vPosition = window->m_vRealPosition.goal();
 50+			window->m_vLastFloatingSize = window->m_vRealSize.goal();
 51+			window->m_vSize = window->m_vRealSize.goal();
 52 		}
 53 
 54 		if (fullscreen_mode == FULLSCREEN_FULL) {
 55@@ -573,7 +573,7 @@ void Hy3Layout::fullscreenRequestForWindow(
 56 	}
 57 
 58 	g_pCompositor->updateWindowAnimatedDecorationValues(window);
 59-	g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goalv());
 60+	g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goal());
 61 	g_pCompositor->changeWindowZOrder(window, true);
 62 	this->recalculateMonitor(monitor->ID);
 63 }
 64@@ -1085,14 +1085,14 @@ Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) {
 65 				auto& children = node.data.as_group.children;
 66 				auto& tab_bar = *node.data.as_group.tab_bar;
 67 
 68-				auto size = tab_bar.size.vec();
 69-				auto x = pos.x - tab_bar.pos.vec().x;
 70+				auto size = tab_bar.size.value();
 71+				auto x = pos.x - tab_bar.pos.value().x;
 72 				auto child_iter = children.begin();
 73 
 74 				for (auto& tab: tab_bar.bar.entries) {
 75 					if (child_iter == children.end()) break;
 76 
 77-					if (x > tab.offset.fl() * size.x && x < (tab.offset.fl() + tab.width.fl()) * size.x) {
 78+					if (x > tab.offset.value() * size.x && x < (tab.offset.value() + tab.width.value()) * size.x) {
 79 						*focused_node = *child_iter;
 80 						return &node;
 81 					}
 82@@ -1316,7 +1316,7 @@ fullscreen:
 83 // 	goto fsupdate;
 84 fsupdate:
 85 	g_pCompositor->updateWindowAnimatedDecorationValues(window);
 86-	g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goalv());
 87+	g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goal());
 88 	g_pCompositor->changeWindowZOrder(window, true);
 89 	this->recalculateMonitor(monitor->ID);
 90 }
 91diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 92index e7049fb932a4fc7343308a94137a52c37548e279..c79d089aca2ca513862a38d2774c1584a5a0ff57 100644
 93--- a/src/TabGroup.cpp
 94+++ b/src/TabGroup.cpp
 95@@ -12,7 +12,6 @@
 96 
 97 Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_bar), node(node) {
 98 	this->focused.create(
 99-	    AVARTYPE_FLOAT,
100 	    0.0f,
101 	    g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"),
102 	    nullptr,
103@@ -20,7 +19,6 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
104 	);
105 
106 	this->urgent.create(
107-	    AVARTYPE_FLOAT,
108 	    0.0f,
109 	    g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"),
110 	    nullptr,
111@@ -28,7 +26,6 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
112 	);
113 
114 	this->offset.create(
115-	    AVARTYPE_FLOAT,
116 	    -1.0f,
117 	    g_pConfigManager->getAnimationPropertyConfig("windowsMove"),
118 	    nullptr,
119@@ -36,7 +33,6 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
120 	);
121 
122 	this->width.create(
123-	    AVARTYPE_FLOAT,
124 	    -1.0f,
125 	    g_pConfigManager->getAnimationPropertyConfig("windowsMove"),
126 	    nullptr,
127@@ -44,7 +40,6 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
128 	);
129 
130 	this->vertical_pos.create(
131-	    AVARTYPE_FLOAT,
132 	    1.0f,
133 	    g_pConfigManager->getAnimationPropertyConfig("windowsIn"),
134 	    nullptr,
135@@ -52,13 +47,17 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
136 	);
137 
138 	this->fade_opacity.create(
139-	    AVARTYPE_FLOAT,
140 	    0.0f,
141 	    g_pConfigManager->getAnimationPropertyConfig("windowsIn"),
142 	    nullptr,
143 	    AVARDAMAGE_NONE
144 	);
145 
146+	// !!! Can be removed after hyprland#4992
147+	this->offset = -1.0f;
148+	this->width = -1.0f;
149+	this->vertical_pos = 1.0f;
150+
151 	this->focused.registerVar();
152 	this->urgent.registerVar();
153 	this->offset.registerVar();
154@@ -89,14 +88,14 @@ bool Hy3TabBarEntry::operator==(const Hy3TabBarEntry& entry) const {
155 }
156 
157 void Hy3TabBarEntry::setFocused(bool focused) {
158-	if (this->focused.goalf() != focused) {
159+	if (this->focused.goal() != focused) {
160 		this->focused = focused;
161 	}
162 }
163 
164 void Hy3TabBarEntry::setUrgent(bool urgent) {
165-	if (urgent && this->focused.goalf() == 1.0) urgent = false;
166-	if (this->urgent.goalf() != urgent) {
167+	if (urgent && this->focused.goal() == 1.0) urgent = false;
168+	if (this->urgent.goal() != urgent) {
169 		this->urgent = urgent;
170 	}
171 }
172@@ -121,7 +120,7 @@ void Hy3TabBarEntry::unDestroy() {
173 }
174 
175 bool Hy3TabBarEntry::shouldRemove() {
176-	return this->destroying && (this->vertical_pos.fl() == 1.0 || this->width.fl() == 0.0);
177+	return this->destroying && (this->vertical_pos.value() == 1.0 || this->width.value() == 0.0);
178 }
179 
180 void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
181@@ -149,8 +148,8 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
182 	    // clang-format off
183 			|| this->last_render.x != box.x
184 			|| this->last_render.y != box.y
185-	    || this->last_render.focused != this->focused.fl()
186-			|| this->last_render.urgent != this->urgent.fl()
187+	    || this->last_render.focused != this->focused.value()
188+			|| this->last_render.urgent != this->urgent.value()
189 	    || this->last_render.window_title != this->window_title
190 	    || this->last_render.rounding != rounding
191 			|| this->last_render.text_font != *text_font
192@@ -167,8 +166,8 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
193 	{
194 		this->last_render.x = box.x;
195diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
196index 6cf92c7af9bbc78668d80221416f4d3f4b4de69f..77f78745d90b3d22c10ec7cc98dc063b27000033 100644
197--- a/src/TabGroup.hpp
198+++ b/src/TabGroup.hpp
199@@ -16,12 +16,12 @@ struct Hy3TabBarEntry {
200 	std::string window_title;
201 	bool destroying = false;
202 	CTexture texture;
203-	CAnimatedVariable focused;
204-	CAnimatedVariable urgent;
205-	CAnimatedVariable offset;       // 0.0-1.0 of total bar
206-	CAnimatedVariable width;        // 0.0-1.0 of total bar
207-	CAnimatedVariable vertical_pos; // 0.0-1.0, user specified direction
208-	CAnimatedVariable fade_opacity; // 0.0-1.0
209+	CAnimatedVariable<float> focused;
210+	CAnimatedVariable<float> urgent;
211+	CAnimatedVariable<float> offset;       // 0.0-1.0 of total bar
212+	CAnimatedVariable<float> width;        // 0.0-1.0 of total bar
213+	CAnimatedVariable<float> vertical_pos; // 0.0-1.0, user specified direction
214+	CAnimatedVariable<float> fade_opacity; // 0.0-1.0
215 	Hy3TabBar& tab_bar;
216 	Hy3Node& node; // only used for comparioson. do not deref.
217 
218@@ -62,7 +62,7 @@ public:
219 	bool destroy = false;
220 	bool dirty = true;
221 	bool damaged = true;
222-	CAnimatedVariable fade_opacity;
223+	CAnimatedVariable<float> fade_opacity;
224 
225 	Hy3TabBar();
226 	void beginDestroy();
227@@ -89,8 +89,8 @@ public:
228 	int workspace_id = -1;
229 	bool hidden = false;
230 	Hy3TabBar bar;
231-	CAnimatedVariable pos;
232-	CAnimatedVariable size;
233+	CAnimatedVariable<Vector2D> pos;
234+	CAnimatedVariable<Vector2D> size;
235 
236 	// initialize a group with the given node. UB if node is not a group.
237 	Hy3TabGroup(Hy3Node&);