2024-08-05 19:58:21 +02:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2024-11-14 21:38:16 +01:00
|
|
|
#include <set>
|
2024-08-05 19:58:21 +02:00
|
|
|
#include <array>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <hyprutils/math/Vector2D.hpp>
|
|
|
|
#include "helpers/memory/Memory.hpp"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <X11/Xcursor/Xcursor.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
// gangsta bootleg XCursor impl. adidas balkanized
|
|
|
|
struct SXCursorImage {
|
|
|
|
Vector2D size;
|
|
|
|
Vector2D hotspot;
|
|
|
|
std::vector<uint32_t> pixels; // XPixel is a u32
|
|
|
|
uint32_t delay; // animation delay to next frame (ms)
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SXCursors {
|
|
|
|
std::vector<SXCursorImage> images;
|
|
|
|
std::string shape;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CXCursorManager {
|
|
|
|
public:
|
|
|
|
CXCursorManager();
|
|
|
|
~CXCursorManager() = default;
|
|
|
|
|
2024-08-16 18:00:59 +02:00
|
|
|
void loadTheme(const std::string& name, int size, float scale);
|
|
|
|
SP<SXCursors> getShape(std::string const& shape, int size, float scale);
|
2024-08-13 19:27:00 +02:00
|
|
|
void syncGsettings();
|
2024-08-05 19:58:21 +02:00
|
|
|
|
|
|
|
private:
|
2024-11-14 21:38:16 +01:00
|
|
|
SP<SXCursors> createCursor(std::string const& shape, XcursorImages* xImages);
|
|
|
|
std::set<std::string> themePaths(std::string const& theme);
|
|
|
|
std::string getLegacyShapeName(std::string const& shape);
|
|
|
|
std::vector<SP<SXCursors>> loadStandardCursors(std::string const& name, int size);
|
|
|
|
std::vector<SP<SXCursors>> loadAllFromDir(std::string const& path, int size);
|
2024-08-05 19:58:21 +02:00
|
|
|
|
2024-11-14 21:38:16 +01:00
|
|
|
int lastLoadSize = 0;
|
|
|
|
float lastLoadScale = 0;
|
|
|
|
std::string themeName = "";
|
|
|
|
SP<SXCursors> defaultCursor;
|
|
|
|
SP<SXCursors> hyprCursor;
|
|
|
|
std::vector<SP<SXCursors>> cursors;
|
2024-08-13 19:27:00 +02:00
|
|
|
};
|