e93aa49b238c5753b8da4b67cf8445d60b0a6aa3

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

Message

Update to latest hyprland revision

Fix resizeActiveWindow breakage

Diff

This diff is truncated to protect this page.

  1diff --git a/flake.lock b/flake.lock
  2index d4e49b3c2fe50ad699f2c297c1de172cbb6dc658..966481a7be1c1816b979161ff5632c692a6a11cb 100644
  3--- a/flake.lock
  4+++ b/flake.lock
  5@@ -8,11 +8,11 @@
  6         "xdph": "xdph"
  7       },
  8       "locked": {
  9-        "lastModified": 1687865038,
 10-        "narHash": "sha256-zFTxFNXmXc2XOriWtNzuznEICcSBnIbRVVR/M5w/Y40=",
 11+        "lastModified": 1689264334,
 12+        "narHash": "sha256-CJv3Qi00et2dFBWXTx9ysYdYauFtxxs+3pXr0gq/UX0=",
 13         "owner": "hyprwm",
 14         "repo": "Hyprland",
 15-        "rev": "d83296c7a9029eccc04544ddf0a8387d8104b882",
 16+        "rev": "f8def68e7e761e33dd51c197ac89194a51fcb60f",
 17         "type": "github"
 18       },
 19       "original": {
 20@@ -44,11 +44,11 @@
 21     },
 22     "nixpkgs": {
 23       "locked": {
 24-        "lastModified": 1687502512,
 25-        "narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=",
 26+        "lastModified": 1688500189,
 27+        "narHash": "sha256-djYYiY4lzJOlXOnTHytH6BUugrxHDZjuGxTSrU4gt4M=",
 28         "owner": "NixOS",
 29         "repo": "nixpkgs",
 30-        "rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f",
 31+        "rev": "78419edadf0fabbe5618643bd850b2f2198ed060",
 32         "type": "github"
 33       },
 34       "original": {
 35diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 36index 6497d27a7b5cbfaf6deb78d8a9541c89ea294064..5b0676622586c268efce67324283232ac6eae797 100644
 37--- a/src/Hy3Layout.cpp
 38+++ b/src/Hy3Layout.cpp
 39@@ -258,42 +258,22 @@ void Hy3Layout::recalculateWindow(CWindow* window) {
 40 	node->recalcSizePosRecursive();
 41 }
 42 
 43-void Hy3Layout::onBeginDragWindow() {
 44-	this->drag_flags.started = false;
 45-	IHyprLayout::onBeginDragWindow();
 46-}
 47-
 48-void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
 49+void Hy3Layout::resizeActiveWindow(const Vector2D& delta, eRectCorner corner, CWindow* pWindow) {
 50 	auto window = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
 51 	if (!g_pCompositor->windowValidMapped(window)) return;
 52 
 53 	auto* node = this->getNodeFromWindow(window);
 54 	if (node == nullptr) return;
 55 
 56-	if (!this->drag_flags.started) {
 57-		if (g_pInputManager->currentlyDraggedWindow == window) {
 58-			auto mouse = g_pInputManager->getMouseCoordsInternal();
 59-			auto mouse_offset = mouse - window->m_vPosition;
 60+	bool drag_x;
 61+	bool drag_y;
 62 
 63-			this->drag_flags = {
 64-			    .started = true,
 65-			    .xExtent = mouse_offset.x > window->m_vSize.x / 2,
 66-			    .yExtent = mouse_offset.y > window->m_vSize.y / 2,
 67-			};
 68-
 69-			Debug::log(
 70-			    LOG,
 71-			    "Positive offsets - x: %d, y: %d",
 72-			    this->drag_flags.xExtent,
 73-			    this->drag_flags.yExtent
 74-			);
 75-		} else {
 76-			this->drag_flags = {
 77-			    .started = false,
 78-			    .xExtent = delta.x > 0,
 79-			    .yExtent = delta.y > 0,
 80-			};
 81-		}
 82+	if (corner == CORNER_NONE) {
 83+		drag_x = delta.x > 0;
 84+		drag_y = delta.y > 0;
 85+	} else {
 86+		drag_x = corner == CORNER_TOPRIGHT || corner == CORNER_BOTTOMRIGHT;
 87+		drag_y = corner == CORNER_BOTTOMLEFT || corner == CORNER_BOTTOMRIGHT;
 88 	}
 89 
 90 	const auto animate
 91@@ -330,15 +310,15 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
 92 			// treat tabbed layouts as if they dont exist during resizing
 93 			goto cont;
 94 		case Hy3GroupLayout::SplitH:
 95-			if ((this->drag_flags.xExtent && group.children.back() == inner_node)
 96-			    || (!this->drag_flags.xExtent && group.children.front() == inner_node))
 97+			if ((drag_x && group.children.back() == inner_node)
 98+			    || (!drag_x && group.children.front() == inner_node))
 99 			{
100 				goto cont;
101 			}
102 			break;
103 		case Hy3GroupLayout::SplitV:
104-			if ((this->drag_flags.yExtent && group.children.back() == inner_node)
105-			    || (!this->drag_flags.yExtent && group.children.front() == inner_node))
106+			if ((drag_y && group.children.back() == inner_node)
107+			    || (!drag_y && group.children.front() == inner_node))
108 			{
109 				goto cont;
110 			}
111@@ -368,15 +348,15 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
112 			// treat tabbed layouts as if they dont exist during resizing
113 			goto cont2;
114 		case Hy3GroupLayout::SplitH:
115-			if ((this->drag_flags.xExtent && group.children.back() == outer_node)
116-			    || (!this->drag_flags.xExtent && group.children.front() == outer_node))
117+			if ((drag_x && group.children.back() == outer_node)
118+			    || (!drag_x && group.children.front() == outer_node))
119 			{
120 				goto cont2;
121 			}
122 			break;
123 		case Hy3GroupLayout::SplitV:
124-			if ((this->drag_flags.yExtent && group.children.back() == outer_node)
125-			    || (!this->drag_flags.yExtent && group.children.front() == outer_node))
126+			if ((drag_y && group.children.back() == outer_node)
127+			    || (!drag_y && group.children.front() == outer_node))
128 			{
129 				goto cont2;
130 			}
131@@ -399,7 +379,7 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
132 
133 		auto iter = std::find(inner_group.children.begin(), inner_group.children.end(), inner_node);
134 
135-		if (this->drag_flags.xExtent) {
136+		if (drag_x) {
137 			if (inner_node == inner_group.children.back()) break;
138 			iter = std::next(iter);
139diff --git a/src/Hy3Layout.hpp b/src/Hy3Layout.hpp
140index d6d4186a3dd2128a53d03be764a778d86f88aff2..d87f945233a654162e19e84dad02f53d2f01a0d1 100644
141--- a/src/Hy3Layout.hpp
142+++ b/src/Hy3Layout.hpp
143@@ -46,8 +46,8 @@ public:
144 	virtual bool isWindowTiled(CWindow*);
145 	virtual void recalculateMonitor(const int& monitor_id);
146 	virtual void recalculateWindow(CWindow*);
147-	virtual void onBeginDragWindow();
148-	virtual void resizeActiveWindow(const Vector2D& delta, CWindow* pWindow = nullptr);
149+	virtual void
150+	resizeActiveWindow(const Vector2D& delta, eRectCorner corner, CWindow* pWindow = nullptr);
151 	virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool enable_fullscreen);
152 	virtual std::any layoutMessage(SLayoutMessageHeader header, std::string content);
153 	virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
154@@ -84,12 +84,6 @@ public:
155 	std::list<Hy3TabGroup> tab_groups;
156 
157 private:
158-	struct {
159-		bool started = false;
160-		bool xExtent = false;
161-		bool yExtent = false;
162-	} drag_flags;
163-
164 	Hy3Node* getNodeFromWindow(CWindow*);
165 	void applyNodeDataToWindow(Hy3Node*, bool no_animation = false);
166