mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-11-17 02:35:57 +01:00
core: formatting and small fixes
This commit is contained in:
parent
ceecc4e7da
commit
d1dcce9a00
3 changed files with 20 additions and 11 deletions
|
@ -21,7 +21,6 @@ namespace Hyprcursor {
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
struct for cursor shape data
|
struct for cursor shape data
|
||||||
*/
|
*/
|
||||||
|
@ -78,6 +77,8 @@ namespace Hyprcursor {
|
||||||
image.delay = images[i]->delay;
|
image.delay = images[i]->delay;
|
||||||
image.size = images[i]->size;
|
image.size = images[i]->size;
|
||||||
image.surface = images[i]->surface;
|
image.surface = images[i]->surface;
|
||||||
|
image.hotspotX = images[i]->hotspotX;
|
||||||
|
image.hotspotY = images[i]->hotspotY;
|
||||||
data.images.push_back(image);
|
data.images.push_back(image);
|
||||||
|
|
||||||
free(images[i]);
|
free(images[i]);
|
||||||
|
|
|
@ -10,6 +10,8 @@ struct SCursorImageData {
|
||||||
cairo_surface_t* surface;
|
cairo_surface_t* surface;
|
||||||
int size;
|
int size;
|
||||||
int delay;
|
int delay;
|
||||||
|
int hotspotX;
|
||||||
|
int hotspotY;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct SCursorImageData hyprcursor_cursor_image_data;
|
typedef struct SCursorImageData hyprcursor_cursor_image_data;
|
||||||
|
|
|
@ -166,11 +166,15 @@ SCursorImageData** CHyprcursorManager::getShapesC(int& outSize, const char* shap
|
||||||
std::string REQUESTEDSHAPE = shape_;
|
std::string REQUESTEDSHAPE = shape_;
|
||||||
|
|
||||||
std::vector<SLoadedCursorImage*> resultingImages;
|
std::vector<SLoadedCursorImage*> resultingImages;
|
||||||
|
float hotX = 0, hotY = 0;
|
||||||
|
|
||||||
for (auto& shape : impl->theme.shapes) {
|
for (auto& shape : impl->theme.shapes) {
|
||||||
if (REQUESTEDSHAPE != shape->directory && std::find(shape->overrides.begin(), shape->overrides.end(), REQUESTEDSHAPE) == shape->overrides.end())
|
if (REQUESTEDSHAPE != shape->directory && std::find(shape->overrides.begin(), shape->overrides.end(), REQUESTEDSHAPE) == shape->overrides.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
hotX = shape->hotspotX;
|
||||||
|
hotY = shape->hotspotY;
|
||||||
|
|
||||||
// matched :)
|
// matched :)
|
||||||
bool foundAny = false;
|
bool foundAny = false;
|
||||||
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
||||||
|
@ -229,6 +233,8 @@ SCursorImageData** CHyprcursorManager::getShapesC(int& outSize, const char* shap
|
||||||
data[i]->delay = resultingImages[i]->delay;
|
data[i]->delay = resultingImages[i]->delay;
|
||||||
data[i]->size = resultingImages[i]->side;
|
data[i]->size = resultingImages[i]->side;
|
||||||
data[i]->surface = resultingImages[i]->cairoSurface;
|
data[i]->surface = resultingImages[i]->cairoSurface;
|
||||||
|
data[i]->hotspotX = hotX * data[i]->size;
|
||||||
|
data[i]->hotspotY = hotY * data[i]->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
outSize = resultingImages.size();
|
outSize = resultingImages.size();
|
||||||
|
|
Loading…
Reference in a new issue