Fix window resize without mouse

This commit is contained in:
outfoxxed 2023-05-14 16:14:58 -07:00
parent 1ac5b645e5
commit 1c98666342
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -769,16 +769,24 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
if (node == nullptr) return; if (node == nullptr) return;
if (!this->drag_flags.started) { if (!this->drag_flags.started) {
auto mouse = g_pInputManager->getMouseCoordsInternal(); if (g_pInputManager->currentlyDraggedWindow == window) {
auto mouseOffset = mouse - window->m_vPosition; auto mouse = g_pInputManager->getMouseCoordsInternal();
auto mouse_offset = mouse - window->m_vPosition;
this->drag_flags = { this->drag_flags = {
.started = true, .started = true,
.xExtent = mouseOffset.x > window->m_vSize.x / 2, .xExtent = mouse_offset.x > window->m_vSize.x / 2,
.yExtent = mouseOffset.y > window->m_vSize.y / 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; const auto animate = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue;