1c9866634205bc279f1b96d6b2a8dfee32a40ac9

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

Message

Fix window resize without mouse

Diff

 1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 2index 7f1d918474debee82fb8659dac7f34907a51d339..95995b28aed8119cb21e56f0c57bcf8db6b4be63 100644
 3--- a/src/Hy3Layout.cpp
 4+++ b/src/Hy3Layout.cpp
 5@@ -769,16 +769,24 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
 6 	if (node == nullptr) return;
 7 
 8 	if (!this->drag_flags.started) {
 9-		auto mouse = g_pInputManager->getMouseCoordsInternal();
10-		auto mouseOffset = mouse - window->m_vPosition;
11-
12-		this->drag_flags = {
13-			.started = true,
14-			.xExtent = mouseOffset.x > window->m_vSize.x / 2,
15-			.yExtent = mouseOffset.y > window->m_vSize.y / 2,
16-		};
17+		if (g_pInputManager->currentlyDraggedWindow == window) {
18+			auto mouse = g_pInputManager->getMouseCoordsInternal();
19+			auto mouse_offset = mouse - window->m_vPosition;
20+
21+			this->drag_flags = {
22+				.started = true,
23+				.xExtent = mouse_offset.x > window->m_vSize.x / 2,
24+				.yExtent = mouse_offset.y > window->m_vSize.y / 2,
25+			};
26 
27-		Debug::log(LOG, "Positive offsets - x: %d, y: %d", this->drag_flags.xExtent, this->drag_flags.yExtent);
28+			Debug::log(LOG, "Positive offsets - x: %d, y: %d", this->drag_flags.xExtent, this->drag_flags.yExtent);
29+		} else {
30+			this->drag_flags = {
31+				.started = false,
32+				.xExtent = delta.x > 0,
33+				.yExtent = delta.y > 0,
34+			};
35+		}
36 	}
37 
38 	const auto animate = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue;