From c58fcfbce2c2e9f12cad7771555ce38b515a3389 Mon Sep 17 00:00:00 2001 From: djvs <2954343+djvs@users.noreply.github.com> Date: Tue, 12 Mar 2024 22:43:22 -0400 Subject: input: add general:resize_corner for manual resizing (#5090) * Resize corner config thing * clang-format --------- Co-authored-by: djvs --- src/config/ConfigManager.cpp | 1 + src/layout/IHyprLayout.cpp | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 09733596..89195a27 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -317,6 +317,7 @@ CConfigManager::CConfigManager() { m_pConfig->addConfigValue("general:hover_icon_on_border", Hyprlang::INT{1}); m_pConfig->addConfigValue("general:layout", {"dwindle"}); m_pConfig->addConfigValue("general:allow_tearing", Hyprlang::INT{0}); + m_pConfig->addConfigValue("general:resize_corner", Hyprlang::INT{0}); m_pConfig->addConfigValue("misc:disable_hyprland_logo", Hyprlang::INT{0}); m_pConfig->addConfigValue("misc:disable_splash_rendering", Hyprlang::INT{0}); diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index 433434de..d2ec1ab1 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -217,7 +217,27 @@ void IHyprLayout::onBeginDragWindow() { m_vLastDragXY = m_vBeginDragXY; // get the grab corner - if (m_vBeginDragXY.x < m_vBeginDragPositionXY.x + m_vBeginDragSizeXY.x / 2.0) { + static auto RESIZECORNER = CConfigValue("general:resize_corner"); + if (*RESIZECORNER != 0 && *RESIZECORNER <= 4) { + switch (*RESIZECORNER) { + case 1: + m_eGrabbedCorner = CORNER_TOPLEFT; + g_pInputManager->setCursorImageUntilUnset("nw-resize"); + break; + case 2: + m_eGrabbedCorner = CORNER_TOPRIGHT; + g_pInputManager->setCursorImageUntilUnset("ne-resize"); + break; + case 3: + m_eGrabbedCorner = CORNER_BOTTOMRIGHT; + g_pInputManager->setCursorImageUntilUnset("se-resize"); + break; + case 4: + m_eGrabbedCorner = CORNER_BOTTOMLEFT; + g_pInputManager->setCursorImageUntilUnset("sw-resize"); + break; + } + } else if (m_vBeginDragXY.x < m_vBeginDragPositionXY.x + m_vBeginDragSizeXY.x / 2.0) { if (m_vBeginDragXY.y < m_vBeginDragPositionXY.y + m_vBeginDragSizeXY.y / 2.0) { m_eGrabbedCorner = CORNER_TOPLEFT; g_pInputManager->setCursorImageUntilUnset("nw-resize"); -- cgit v1.2.3