feat: use hyprcursor for magnified shapes

closes #20
This commit is contained in:
Virt 2024-11-09 16:12:27 +01:00
commit 438daf1dfb
9 changed files with 268 additions and 13 deletions

View file

@ -1,15 +1,18 @@
#include "globals.hpp"
#include <memory>
#define private public
#include <hyprland/src/managers/PointerManager.hpp>
#undef private
#include <hyprutils/math/Vector2D.hpp>
#include <hyprland/src/managers/eventLoop/EventLoopManager.hpp>
#include <hyprcursor/hyprcursor.hpp>
#include "mode/ModeRotate.hpp"
#include "mode/ModeTilt.hpp"
#include "mode/ModeStretch.hpp"
#include "other/Shake.hpp"
#include "highres.hpp"
class CDynamicCursors {
public:
@ -34,6 +37,8 @@ class CDynamicCursors {
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();
@ -41,6 +46,9 @@ class CDynamicCursors {
private:
SP<CEventLoopTimer> tick;
/* hyprcursor handler for highres images */
CHighresHandler highres;
// current state of the cursor
SModeResult resultMode;
double resultShake;
@ -70,4 +78,4 @@ class CDynamicCursors {
void calculate(EModeUpdate type);
};
inline std::unique_ptr<CDynamicCursors> g_pDynamicCursors;
inline UP<CDynamicCursors> g_pDynamicCursors;