diff options
| author | MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> | 2023-08-30 15:39:22 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-30 17:39:22 +0200 |
| commit | b10cae3010f5b1d853eb13f8a591ee10d67fe51e (patch) | |
| tree | 0a98823af6cb773151a0ea823296b84b833f14a0 /src/layout/DwindleLayout.cpp | |
| parent | c98a00678c1f3b051c2440b72f58cd9ecfdae70d (diff) | |
decos: groupbar mouse interaction (#3102)
* allow groupbar clicking
modified: src/Window.cpp
modified: src/Window.hpp
modified: src/managers/input/InputManager.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.hpp
* remove setting pos inside insertWindowToGroup()
modified: src/Window.cpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/MasterLayout.cpp
modified: src/managers/KeybindManager.cpp
* add group window by index and group size functions
modified: src/Window.cpp
modified: src/Window.hpp
modified: src/managers/input/InputManager.cpp
* allow dragging into groupbar
modified: src/Window.cpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/MasterLayout.cpp
* allow dragging from groupbar
modified: src/managers/KeybindManager.cpp
* try groupbar clicking before border resize
modified: src/managers/input/InputManager.cpp
* block grabbing groupbar on floating (crash)
remove later when crashing is fixed
modified: src/managers/KeybindManager.cpp
* remove redundant { }
modified: src/layout/DwindleLayout.cpp
modified: src/layout/MasterLayout.cpp
* implement getWindowDecorationBox()
modified: src/Window.cpp
modified: src/Window.hpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/MasterLayout.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/input/InputManager.cpp
modified: src/render/decorations/CHyprDropShadowDecoration.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.cpp
modified: src/render/decorations/IHyprWindowDecoration.cpp
modified: src/render/decorations/IHyprWindowDecoration.hpp
* fix crash when moveoutofgroup in floating windows
also removes dragging from floating windows limitation
modified: src/layout/IHyprLayout.cpp
modified: src/managers/KeybindManager.cpp
* use CRegion in getWindowDecorationBox()
modified: src/helpers/Region.cpp
modified: src/helpers/Region.hpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/MasterLayout.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/input/InputManager.cpp
modified: src/render/decorations/IHyprWindowDecoration.cpp
modified: src/render/decorations/IHyprWindowDecoration.hpp
* add groupbar scrolling
modified: src/config/ConfigManager.cpp
modified: src/managers/input/InputManager.cpp
* change name to getWindowDecorationRegion()
modified: src/layout/DwindleLayout.cpp
modified: src/layout/MasterLayout.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/input/InputManager.cpp
modified: src/render/decorations/IHyprWindowDecoration.cpp
modified: src/render/decorations/IHyprWindowDecoration.hpp
* make dragging from group less hacky for floating
modified: src/managers/KeybindManager.cpp
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
| -rw-r--r-- | src/layout/DwindleLayout.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index e513c17d..5bee0f4f 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -312,28 +312,32 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) { return; } + const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); + // if it's a group, add the window if (OPENINGON->pWindow->m_sGroupData.pNextWindow && !OPENINGON->pWindow->getGroupHead()->m_sGroupData.locked && !g_pKeybindManager->m_bGroupsLocked) { // target is an unlocked group - if (!pWindow->m_sGroupData.pNextWindow) { // source is not a group - m_lDwindleNodesData.remove(*PNODE); - OPENINGON->pWindow->insertWindowToGroup(pWindow); - OPENINGON->pWindow->setGroupCurrent(pWindow); + if (!pWindow->m_sGroupData.pNextWindow || !pWindow->getGroupHead()->m_sGroupData.locked) { // source is not a group or an unlocked group + if (!pWindow->m_sGroupData.pNextWindow) + pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(pWindow)); - pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(pWindow)); - pWindow->updateWindowDecos(); - recalculateWindow(pWindow); + m_lDwindleNodesData.remove(*PNODE); - g_pCompositor->focusWindow(pWindow); - return; - } + const wlr_box box = OPENINGON->pWindow->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents(); + if (wlr_box_contains_point(&box, MOUSECOORDS.x, MOUSECOORDS.y)) { // TODO: Deny when not using mouse + const int SIZE = OPENINGON->pWindow->getGroupSize(); + const int INDEX = (int)((MOUSECOORDS.x - box.x) * 2 * SIZE / box.width + 1) / 2 - 1; + CWindow* pWindowInsertAfter = OPENINGON->pWindow->getGroupWindowByIndex(INDEX); + pWindowInsertAfter->insertWindowToGroup(pWindow); + if (INDEX == -1) + std::swap(pWindow->m_sGroupData.pNextWindow->m_sGroupData.head, pWindow->m_sGroupData.head); + } else { + static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("misc:group_insert_after_current")->intValue; + (*USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow); + } - if (!pWindow->getGroupHead()->m_sGroupData.locked) { // source is an unlocked group - m_lDwindleNodesData.remove(*PNODE); - OPENINGON->pWindow->insertWindowToGroup(pWindow); OPENINGON->pWindow->setGroupCurrent(pWindow); - pWindow->updateWindowDecos(); recalculateWindow(pWindow); @@ -361,8 +365,6 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) { const auto SIDEBYSIDE = NEWPARENT->size.x > NEWPARENT->size.y * *PWIDTHMULTIPLIER; NEWPARENT->splitTop = !SIDEBYSIDE; - const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); - static auto* const PFORCESPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:force_split")->intValue; static auto* const PERMANENTDIRECTIONOVERRIDE = &g_pConfigManager->getConfigValuePtr("dwindle:permanent_direction_override")->intValue; static auto* const PSMARTSPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:smart_split")->intValue; |
