#include "globals.hpp" #define private public #include #undef private #include class CDynamicCursors; class CDynamicCursors { public: /* hook on onCursorMoved */ void onCursorMoved(CPointerManager* pointers); /* called on tick */ void onTick(CPointerManager* pointers); /* hook on renderSoftwareCursorsFor */ void renderSoftware(CPointerManager* pointers, SP pMonitor, timespec* now, CRegion& damage, std::optional overridePos); /* hook on damageIfSoftware*/ void damageSoftware(CPointerManager* pointers); /* hook on renderHWCursorBuffer */ wlr_buffer* renderHardware(CPointerManager* pointers, SP state, SP texture); /* hook on setHWCursorBuffer */ bool setHardware(CPointerManager* pointers, SP state, wlr_buffer* buf); private: // current angle of the cursor in radiants double angle; // current zoom value of the cursor double zoom = 1; // whether we have already locked software bool software = false; // calculates the current angle of the cursor, and changes the cursor shape void calculate(bool tick); // calculate the angle of the cursor if stick double calculateStick(); // this is the end of the virtual stick Vector2D end; // calculate the angle of the cursor if air double calculateAir(); // ring buffer of last position samples std::vector samples; int samples_index = 0; double calculateShake(); std::vector shake_samples; std::vector shake_samples_distance; int shake_samples_index = 0; }; inline std::unique_ptr g_pDynamicCursors;