2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
#ifndef HYPRCURSOR_H
|
|
|
|
#define HYPRCURSOR_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#define CAPI extern "C"
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define CAPI
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2024-03-07 17:01:45 +01:00
|
|
|
#include "shared.h"
|
2024-03-07 16:10:45 +01:00
|
|
|
|
2024-03-07 04:19:38 +01:00
|
|
|
struct hyprcursor_manager_t;
|
|
|
|
|
2024-03-07 16:10:45 +01:00
|
|
|
/*!
|
|
|
|
Simple struct for styles
|
|
|
|
*/
|
|
|
|
struct hyprcursor_cursor_style_info {
|
|
|
|
/*!
|
|
|
|
Shape size.
|
|
|
|
0 means "any" or "unspecified".
|
|
|
|
*/
|
|
|
|
unsigned int size;
|
|
|
|
};
|
|
|
|
|
2024-03-07 04:19:38 +01:00
|
|
|
/*!
|
|
|
|
Basic Hyprcursor manager.
|
|
|
|
|
|
|
|
Has to be created for either a specified theme, or
|
|
|
|
nullptr if you want to use a default from the env.
|
|
|
|
|
|
|
|
If no env is set, picks the first found.
|
|
|
|
|
|
|
|
If none found, hyprcursor_manager_valid will be false.
|
|
|
|
|
|
|
|
If loading fails, hyprcursor_manager_valid will be false.
|
|
|
|
|
|
|
|
The caller gets the ownership, call hyprcursor_manager_free to free this object.
|
|
|
|
*/
|
2024-03-07 16:10:45 +01:00
|
|
|
CAPI struct hyprcursor_manager_t* hyprcursor_manager_create(const char* theme_name);
|
2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Free a hyprcursor_manager_t*
|
|
|
|
*/
|
2024-03-07 16:10:45 +01:00
|
|
|
CAPI void hyprcursor_manager_free(struct hyprcursor_manager_t* manager);
|
2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns true if the theme was successfully loaded,
|
|
|
|
i.e. everything is A-OK and nothing should fail.
|
|
|
|
*/
|
2024-03-07 16:10:45 +01:00
|
|
|
CAPI int hyprcursor_manager_valid(struct hyprcursor_manager_t* manager);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Loads a theme at a given style, synchronously.
|
|
|
|
|
|
|
|
Returns whether it succeeded.
|
|
|
|
*/
|
|
|
|
CAPI int hyprcursor_load_theme_style(struct hyprcursor_manager_t* manager, struct hyprcursor_cursor_style_info info);
|
|
|
|
|
|
|
|
/*!
|
2024-03-07 17:01:45 +01:00
|
|
|
Returns a hyprcursor_cursor_image_data*[] for a given cursor
|
2024-03-07 16:10:45 +01:00
|
|
|
shape and size.
|
|
|
|
|
2024-03-07 17:01:45 +01:00
|
|
|
The entire array needs to be freed instantly after using, see hyprcursor_cursor_image_data_free()
|
|
|
|
|
|
|
|
Surfaces stay valid.
|
|
|
|
|
2024-03-07 16:10:45 +01:00
|
|
|
Once done with a size, call hyprcursor_style_done()
|
|
|
|
*/
|
2024-03-07 17:01:45 +01:00
|
|
|
CAPI hyprcursor_cursor_image_data** hyprcursor_get_cursor_image_data(struct hyprcursor_manager_t* manager, const char* shape, struct hyprcursor_cursor_style_info info, int* out_size);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Free a returned hyprcursor_cursor_image_data.
|
|
|
|
*/
|
|
|
|
CAPI void hyprcursor_cursor_image_data_free(hyprcursor_cursor_image_data** data, int size);
|
2024-03-07 16:10:45 +01:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Marks a certain style as done, allowing it to be potentially freed
|
|
|
|
*/
|
|
|
|
CAPI void hyprcursor_style_done(struct hyprcursor_manager_t* manager, struct hyprcursor_cursor_style_info info);
|
2024-03-07 04:19:38 +01:00
|
|
|
|
|
|
|
#endif
|