summaryrefslogtreecommitdiff
path: root/src/managers/input/trackpad
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-09-08 20:24:45 +0100
committerVaxry <vaxry@vaxry.net>2025-09-08 20:24:51 +0100
commit1e3a06560fa6b2d906f8ecc9ec41b50e9b034cef (patch)
treec90c3678c1170e3dba57a3a1245b9ff575881884 /src/managers/input/trackpad
parentb619f39555b96c70330f4a933dedde7e897e0d81 (diff)
gestures: add unset
ref https://github.com/hyprwm/Hyprland/pull/11490
Diffstat (limited to 'src/managers/input/trackpad')
-rw-r--r--src/managers/input/trackpad/TrackpadGestures.cpp12
-rw-r--r--src/managers/input/trackpad/TrackpadGestures.hpp1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/input/trackpad/TrackpadGestures.cpp b/src/managers/input/trackpad/TrackpadGestures.cpp
index 1d628da4..de5639f8 100644
--- a/src/managers/input/trackpad/TrackpadGestures.cpp
+++ b/src/managers/input/trackpad/TrackpadGestures.cpp
@@ -89,6 +89,18 @@ std::expected<void, std::string> CTrackpadGestures::addGesture(UP<ITrackpadGestu
return {};
}
+std::expected<void, std::string> CTrackpadGestures::removeGesture(size_t fingerCount, eTrackpadGestureDirection direction, uint32_t modMask, float deltaScale) {
+ const auto IT = std::ranges::find_if(
+ m_gestures, [&](const auto& g) { return g->fingerCount == fingerCount && g->direction == direction && g->modMask == modMask && g->deltaScale == deltaScale; });
+
+ if (IT == m_gestures.end())
+ return std::unexpected("Can't remove a non-existent gesture");
+
+ std::erase(m_gestures, *IT);
+
+ return {};
+}
+
void CTrackpadGestures::gestureBegin(const IPointer::SSwipeBeginEvent& e) {
if (m_activeGesture) {
Debug::log(ERR, "CTrackpadGestures::gestureBegin (swipe) but m_activeGesture is already present");
diff --git a/src/managers/input/trackpad/TrackpadGestures.hpp b/src/managers/input/trackpad/TrackpadGestures.hpp
index 3d0745df..411a1fbb 100644
--- a/src/managers/input/trackpad/TrackpadGestures.hpp
+++ b/src/managers/input/trackpad/TrackpadGestures.hpp
@@ -12,6 +12,7 @@ class CTrackpadGestures {
public:
void clearGestures();
std::expected<void, std::string> addGesture(UP<ITrackpadGesture>&& gesture, size_t fingerCount, eTrackpadGestureDirection direction, uint32_t modMask, float deltaScale);
+ std::expected<void, std::string> removeGesture(size_t fingerCount, eTrackpadGestureDirection direction, uint32_t modMask, float deltaScale);
void gestureBegin(const IPointer::SSwipeBeginEvent& e);
void gestureUpdate(const IPointer::SSwipeUpdateEvent& e);