From 1c9866634205bc279f1b96d6b2a8dfee32a40ac9 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 14 May 2023 16:14:58 -0700 Subject: [PATCH] Fix window resize without mouse --- src/Hy3Layout.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 7f1d918..95995b2 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -769,16 +769,24 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) { if (node == nullptr) return; if (!this->drag_flags.started) { - auto mouse = g_pInputManager->getMouseCoordsInternal(); - auto mouseOffset = mouse - window->m_vPosition; + if (g_pInputManager->currentlyDraggedWindow == window) { + auto mouse = g_pInputManager->getMouseCoordsInternal(); + auto mouse_offset = mouse - window->m_vPosition; - this->drag_flags = { - .started = true, - .xExtent = mouseOffset.x > window->m_vSize.x / 2, - .yExtent = mouseOffset.y > window->m_vSize.y / 2, - }; + this->drag_flags = { + .started = true, + .xExtent = mouse_offset.x > window->m_vSize.x / 2, + .yExtent = mouse_offset.y > window->m_vSize.y / 2, + }; - Debug::log(LOG, "Positive offsets - x: %d, y: %d", this->drag_flags.xExtent, this->drag_flags.yExtent); + Debug::log(LOG, "Positive offsets - x: %d, y: %d", this->drag_flags.xExtent, this->drag_flags.yExtent); + } else { + this->drag_flags = { + .started = false, + .xExtent = delta.x > 0, + .yExtent = delta.y > 0, + }; + } } const auto animate = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue;