#include "globals.hpp" #include #define private public #include #undef private #include #include #include #include "mode/ModeRotate.hpp" #include "mode/ModeTilt.hpp" #include "mode/ModeStretch.hpp" #include "other/Shake.hpp" #include "highres.hpp" class CDynamicCursors { public: CDynamicCursors(); ~CDynamicCursors(); /* 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 */ SP renderHardware(CPointerManager* pointers, SP state, SP texture); /* hook on setHWCursorBuffer */ bool setHardware(CPointerManager* pointers, SP state, SP buf); /* hook on setCursorFromName */ void setShape(const std::string& name); /* hook on setCursorSoftware */ void unsetShape(); /* hook on updateTheme */ void updateTheme(); /* hook on move, indicate that next onCursorMoved is actual move */ void setMove(); void dispatchMagnify(std::optional duration, std::optional size); private: SP tick; /* hyprcursor handler for highres images */ CHighresHandler highres; // current state of the cursor SModeResult resultMode; double resultShake; Vector2D lastPos; // used for warp compensation SModeResult resultShown; // whether we have already locked software for cursor zoom bool zoomSoftware = false; // modes CModeRotate rotate; CModeTilt tilt; CModeStretch stretch; /* returns the current mode, nullptr if none is selected */ IMode* currentMode(); IMode* lastMode; // used to reset the mode if it was switched (to prune stale data) // shake CShake shake; /* is set true if a genuine move is being performed, and will be reset to false after onCursorMoved */ bool isMove = false; // calculates the current angle of the cursor, and changes the cursor shape void calculate(EModeUpdate type); }; inline UP g_pDynamicCursors;