input: Add fully configurable trackpad gestures (#11490)

Adds configurable trackpad gestures
This commit is contained in:
Vaxry 2025-08-28 11:20:29 +02:00 committed by GitHub
parent 378e130f14
commit 81bf4eccba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 2518 additions and 940 deletions

View file

@ -0,0 +1,43 @@
#pragma once
#include "../../../../devices/IPointer.hpp"
#include "../GestureTypes.hpp"
class ITrackpadGesture {
public:
virtual ~ITrackpadGesture() = default;
struct STrackpadGestureBegin {
// this has update because we wait for the delta
const IPointer::SSwipeUpdateEvent* swipe = nullptr;
const IPointer::SPinchUpdateEvent* pinch = nullptr;
eTrackpadGestureDirection direction = TRACKPAD_GESTURE_DIR_NONE;
float scale = 1.F;
};
struct STrackpadGestureUpdate {
const IPointer::SSwipeUpdateEvent* swipe = nullptr;
const IPointer::SPinchUpdateEvent* pinch = nullptr;
eTrackpadGestureDirection direction = TRACKPAD_GESTURE_DIR_NONE;
float scale = 1.F;
};
struct STrackpadGestureEnd {
const IPointer::SSwipeEndEvent* swipe = nullptr;
const IPointer::SPinchEndEvent* pinch = nullptr;
eTrackpadGestureDirection direction = TRACKPAD_GESTURE_DIR_NONE;
float scale = 1.F;
};
virtual void begin(const STrackpadGestureBegin& e);
virtual void update(const STrackpadGestureUpdate& e) = 0;
virtual void end(const STrackpadGestureEnd& e) = 0;
virtual float distance(const STrackpadGestureBegin& e);
virtual float distance(const STrackpadGestureUpdate& e);
virtual bool isDirectionSensitive();
protected:
float m_lastPinchScale = 1.F, m_scale = 1.F;
};