diff options
Diffstat (limited to 'src/managers')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 32 | ||||
| -rw-r--r-- | src/managers/input/InputManager.cpp | 37 |
2 files changed, 60 insertions, 9 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 81a2aaf5..d626b8c6 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1226,13 +1226,13 @@ void CKeybindManager::toggleGroup(std::string args) { w->m_sGroupData.head = false; } - bool prevState = g_pKeybindManager->m_bGroupsLocked; + const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked; g_pKeybindManager->m_bGroupsLocked = true; for (auto& w : members) { g_pLayoutManager->getCurrentLayout()->onWindowCreated(w); w->updateWindowDecos(); } - g_pKeybindManager->m_bGroupsLocked = prevState; + g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV; } } @@ -1951,9 +1951,28 @@ void CKeybindManager::mouse(std::string args) { if (PRESSED) { g_pKeybindManager->m_bIsMouseBindActive = true; - g_pInputManager->currentlyDraggedWindow = g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal()); - g_pInputManager->dragMode = MBIND_MOVE; + 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; + } + } + } + g_pInputManager->currentlyDraggedWindow = pWindow; + g_pInputManager->dragMode = MBIND_MOVE; g_pLayoutManager->getCurrentLayout()->onBeginDragWindow(); } else { g_pKeybindManager->m_bIsMouseBindActive = false; @@ -2046,7 +2065,7 @@ void CKeybindManager::moveIntoGroup(std::string args) { if (!PWINDOW || PWINDOW->m_bIsFloating) return; - const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg); + auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg); if (!PWINDOWINDIR || !PWINDOWINDIR->m_sGroupData.pNextWindow) return; @@ -2059,6 +2078,9 @@ void CKeybindManager::moveIntoGroup(std::string args) { g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); // This removes groupped property! + static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("misc:group_insert_after_current")->intValue; + PWINDOWINDIR = *USECURRPOS ? PWINDOWINDIR : PWINDOWINDIR->getGroupTail(); + PWINDOWINDIR->insertWindowToGroup(PWINDOW); PWINDOWINDIR->setGroupCurrent(PWINDOW); PWINDOW->updateWindowDecos(); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index bdb5c527..1739e7cc 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -545,11 +545,25 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) { if (!PASS && !*PPASSMOUSE) return; + const auto mouseCoords = g_pInputManager->getMouseCoordsInternal(); + const auto w = g_pCompositor->vectorToWindowIdeal(mouseCoords); + + if (w && !w->m_bIsFullscreen && !w->hasPopupAt(mouseCoords) && w->m_sGroupData.pNextWindow) { + const wlr_box box = w->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents(); + if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) { + if (e->state == WLR_BUTTON_PRESSED) { + const int SIZE = w->getGroupSize(); + CWindow* pWindow = w->getGroupWindowByIndex((mouseCoords.x - box.x) * SIZE / box.width); + if (w != pWindow) + w->setGroupCurrent(pWindow); + } + return; + } + } + // clicking on border triggers resize // TODO detect click on LS properly if (*PRESIZEONBORDER && !m_bLastFocusOnLS) { - const auto mouseCoords = g_pInputManager->getMouseCoordsInternal(); - const auto w = g_pCompositor->vectorToWindowIdeal(mouseCoords); if (w && !w->m_bIsFullscreen) { const wlr_box real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; if ((!wlr_box_contains_point(&real, mouseCoords.x, mouseCoords.y) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) && !w->hasPopupAt(mouseCoords)) { @@ -613,7 +627,8 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) { } void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) { - static auto* const PSCROLLFACTOR = &g_pConfigManager->getConfigValuePtr("input:touchpad:scroll_factor")->floatValue; + static auto* const PSCROLLFACTOR = &g_pConfigManager->getConfigValuePtr("input:touchpad:scroll_factor")->floatValue; + static auto* const PGROUPBARSCROLLING = &g_pConfigManager->getConfigValuePtr("misc:groupbar_scrolling")->intValue; auto factor = (*PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : *PSCROLLFACTOR); @@ -621,6 +636,20 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) { g_pCompositor->notifyIdleActivity(); + const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); + const auto pWindow = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS); + + if (*PGROUPBARSCROLLING && 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)) { + if (e->delta > 0) + pWindow->setGroupCurrent(pWindow->m_sGroupData.pNextWindow); + else + pWindow->setGroupCurrent(pWindow->getGroupPrevious()); + return; + } + } + if (passEvent) wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta, std::round(factor * e->delta_discrete), e->source); } @@ -1546,7 +1575,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; eBorderIconDirection direction = BORDERICON_NONE; wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE), - box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; + box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) { direction = BORDERICON_NONE; |
