diff options
| author | MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> | 2023-10-29 20:14:47 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-29 20:14:47 +0000 |
| commit | 9abfa9efc627df0765652f862887626af02b5ae1 (patch) | |
| tree | 31258fc1d4fe3fbf5a34d8a6bd5670b0f0e398bc /src/managers/KeybindManager.cpp | |
| parent | 7a5234a0cca2508b7a5ede1fc60dc3ae8b72a51c (diff) | |
input: handle mouse on decorations (#3560)
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 72e7f24e..23adc165 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1839,25 +1839,22 @@ void CKeybindManager::mouse(std::string args) { const auto mouseCoords = g_pInputManager->getMouseCoordsInternal(); CWindow* pWindow = g_pCompositor->vectorToWindowIdeal(mouseCoords); - if (pWindow && !pWindow->m_bIsFullscreen && !pWindow->hasPopupAt(mouseCoords) && pWindow->m_sGroupData.pNextWindow) { - const wlr_box box = pWindow->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents(); - if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) { - const int SIZE = pWindow->getGroupSize(); - pWindow = pWindow->getGroupWindowByIndex((mouseCoords.x - box.x) * SIZE / box.width); - - // hack - g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); - if (!pWindow->m_bIsFloating) { - const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked; - g_pKeybindManager->m_bGroupsLocked = true; - g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow); - g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV; + if (pWindow && !pWindow->m_bIsFullscreen && !pWindow->hasPopupAt(mouseCoords)) { + for (auto& wd : pWindow->m_dWindowDecorations) { + if (!wd->allowsInput()) + continue; + + if (wd->getWindowDecorationRegion().containsPoint(mouseCoords)) { + wd->onBeginWindowDragOnDeco(mouseCoords); + break; } } } - g_pInputManager->currentlyDraggedWindow = pWindow; - g_pInputManager->dragMode = MBIND_MOVE; + if (!g_pInputManager->currentlyDraggedWindow) + g_pInputManager->currentlyDraggedWindow = pWindow; + + g_pInputManager->dragMode = MBIND_MOVE; g_pLayoutManager->getCurrentLayout()->onBeginDragWindow(); } else { g_pKeybindManager->m_bIsMouseBindActive = false; |
