swipe: fix nullptr in onSwipeUpdate (#5191)

This commit is contained in:
Horror Proton 2024-03-21 02:13:31 +08:00 committed by GitHub
parent d904f51716
commit bfc95e992d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -195,11 +195,11 @@ void CInputManager::endWorkspaceSwipe() {
} }
void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) { void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
if (!m_sActiveSwipe.pWorkspaceBegin)
return;
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_invert"); static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_invert");
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" || const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert"); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
if (!m_sActiveSwipe.pWorkspaceBegin)
return;
const double delta = m_sActiveSwipe.delta + (VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx)); const double delta = m_sActiveSwipe.delta + (VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx));
updateWorkspaceSwipe(delta); updateWorkspaceSwipe(delta);