added workspace_swipe_forever

This commit is contained in:
Vaxry 2022-11-03 13:34:06 +00:00
parent f978368a4e
commit d0e47d9fe0
3 changed files with 16 additions and 0 deletions

View file

@ -161,6 +161,7 @@ void CConfigManager::setDefaultVars() {
configValues["gestures:workspace_swipe_min_speed_to_force"].intValue = 30; configValues["gestures:workspace_swipe_min_speed_to_force"].intValue = 30;
configValues["gestures:workspace_swipe_cancel_ratio"].floatValue = 0.5f; configValues["gestures:workspace_swipe_cancel_ratio"].floatValue = 0.5f;
configValues["gestures:workspace_swipe_create_new"].intValue = 1; configValues["gestures:workspace_swipe_create_new"].intValue = 1;
configValues["gestures:workspace_swipe_forever"].intValue = 0;
configValues["input:follow_mouse"].intValue = 1; configValues["input:follow_mouse"].intValue = 1;

View file

@ -147,6 +147,9 @@ private:
wlr_surface* m_pFoundSurfaceToFocus = nullptr; wlr_surface* m_pFoundSurfaceToFocus = nullptr;
SLayerSurface* m_pFoundLSToFocus = nullptr; SLayerSurface* m_pFoundLSToFocus = nullptr;
CWindow* m_pFoundWindowToFocus = nullptr; CWindow* m_pFoundWindowToFocus = nullptr;
// swipe
void beginWorkspaceSwipe();
}; };
inline std::unique_ptr<CInputManager> g_pInputManager; inline std::unique_ptr<CInputManager> g_pInputManager;

View file

@ -19,6 +19,10 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
if (onMonitor < 2 && !*PSWIPENEW) if (onMonitor < 2 && !*PSWIPENEW)
return; // disallow swiping when there's 1 workspace on a monitor return; // disallow swiping when there's 1 workspace on a monitor
beginWorkspaceSwipe();
}
void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
Debug::log(LOG, "Starting a swipe from %s", PWORKSPACE->m_szName.c_str()); Debug::log(LOG, "Starting a swipe from %s", PWORKSPACE->m_szName.c_str());
@ -162,6 +166,7 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue; static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue;
static auto *const PSWIPEINVR = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert")->intValue; static auto *const PSWIPEINVR = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert")->intValue;
static auto *const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue; static auto *const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue;
static auto *const PSWIPEFOREVER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_forever")->intValue;
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert"; const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert";
@ -258,4 +263,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor);
g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID);
if (*PSWIPEFOREVER) {
if (abs(m_sActiveSwipe.delta) >= *PSWIPEDIST) {
onSwipeEnd(nullptr);
beginWorkspaceSwipe();
}
}
} }