hypr-dynamic-cursors/src/cursor.hpp

51 lines
1.6 KiB
C++
Raw Normal View History

2024-06-21 14:32:42 +02:00
#include "globals.hpp"
#define private public
2024-06-21 14:32:42 +02:00
#include <hyprland/src/managers/PointerManager.hpp>
#undef private
2024-06-21 14:32:42 +02:00
#include <hyprutils/math/Vector2D.hpp>
#include "mode/ModeRotate.hpp"
#include "mode/ModeTilt.hpp"
#include "other/Shake.hpp"
2024-06-21 14:32:42 +02:00
class CDynamicCursors {
public:
/* hook on onCursorMoved */
void onCursorMoved(CPointerManager* pointers);
2024-06-26 17:14:16 +02:00
/* called on tick */
void onTick(CPointerManager* pointers);
2024-06-21 16:06:55 +02:00
/* hook on renderSoftwareCursorsFor */
2024-06-21 16:36:10 +02:00
void renderSoftware(CPointerManager* pointers, SP<CMonitor> pMonitor, timespec* now, CRegion& damage, std::optional<Vector2D> overridePos);
/* hook on damageIfSoftware*/
void damageSoftware(CPointerManager* pointers);
/* hook on renderHWCursorBuffer */
wlr_buffer* renderHardware(CPointerManager* pointers, SP<CPointerManager::SMonitorPointerState> state, SP<CTexture> texture);
/* hook on setHWCursorBuffer */
bool setHardware(CPointerManager* pointers, SP<CPointerManager::SMonitorPointerState> state, wlr_buffer* buf);
2024-06-21 14:32:42 +02:00
private:
// current angle of the cursor in radiants
double angle;
2024-06-27 17:21:39 +02:00
// current zoom value of the cursor
double zoom = 1;
// whether we have already locked software for cursor zoom
bool zoomSoftware = false;
// modes
CModeRotate rotate;
CModeTilt tilt;
/* returns the current mode, nullptr if none is selected */
IMode* currentMode();
// shake
CShake shake;
2024-06-26 17:14:16 +02:00
// calculates the current angle of the cursor, and changes the cursor shape
void calculate(EModeUpdate type);
2024-06-21 14:32:42 +02:00
};
inline std::unique_ptr<CDynamicCursors> g_pDynamicCursors;