2025-09-11 21:13:16 +01:00
|
|
|
#include "ExpoGesture.hpp"
|
|
|
|
|
|
|
|
|
|
#include "overview.hpp"
|
|
|
|
|
|
2025-09-11 21:27:43 +01:00
|
|
|
#include <hyprland/src/Compositor.hpp>
|
|
|
|
|
#include <hyprland/src/helpers/Monitor.hpp>
|
|
|
|
|
|
2025-09-11 21:13:16 +01:00
|
|
|
void CExpoGesture::begin(const ITrackpadGesture::STrackpadGestureBegin& e) {
|
|
|
|
|
ITrackpadGesture::begin(e);
|
|
|
|
|
|
|
|
|
|
m_lastDelta = 0.F;
|
2025-09-11 21:27:43 +01:00
|
|
|
|
|
|
|
|
if (!g_pOverview)
|
|
|
|
|
g_pOverview = std::make_unique<COverview>(g_pCompositor->m_lastMonitor->m_activeWorkspace);
|
2025-09-11 21:13:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CExpoGesture::update(const ITrackpadGesture::STrackpadGestureUpdate& e) {
|
|
|
|
|
m_lastDelta += distance(e);
|
|
|
|
|
|
|
|
|
|
if (m_lastDelta <= 0.01) // plugin will crash if swipe ends at <= 0
|
|
|
|
|
m_lastDelta = 0.01;
|
|
|
|
|
|
|
|
|
|
g_pOverview->onSwipeUpdate(m_lastDelta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CExpoGesture::end(const ITrackpadGesture::STrackpadGestureEnd& e) {
|
|
|
|
|
g_pOverview->onSwipeEnd();
|
|
|
|
|
}
|