mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-12-22 10:19:48 +01:00
e
This commit is contained in:
parent
3d3e8ad1e6
commit
0af712e151
1 changed files with 7 additions and 5 deletions
|
@ -454,8 +454,10 @@ bool CHyprcursorManager::loadThemeStyle(const SCursorStyleInfo& info) {
|
||||||
bool sizeFound = false;
|
bool sizeFound = false;
|
||||||
|
|
||||||
if (shape->shapeType == SHAPE_PNG) {
|
if (shape->shapeType == SHAPE_PNG) {
|
||||||
|
const int IDEALSIDE = std::round(info.size / shape->nominalSize);
|
||||||
|
|
||||||
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
||||||
if (image->side != std::round(info.size / shape->nominalSize))
|
if (image->side != IDEALSIDE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sizeFound = true;
|
sizeFound = true;
|
||||||
|
@ -469,7 +471,7 @@ bool CHyprcursorManager::loadThemeStyle(const SCursorStyleInfo& info) {
|
||||||
SLoadedCursorImage* leader = nullptr;
|
SLoadedCursorImage* leader = nullptr;
|
||||||
int leaderVal = 1000000;
|
int leaderVal = 1000000;
|
||||||
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
||||||
if (image->side < info.size)
|
if (image->side < IDEALSIDE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (image->side > leaderVal)
|
if (image->side > leaderVal)
|
||||||
|
@ -481,7 +483,7 @@ bool CHyprcursorManager::loadThemeStyle(const SCursorStyleInfo& info) {
|
||||||
|
|
||||||
if (!leader) {
|
if (!leader) {
|
||||||
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
for (auto& image : impl->loadedShapes[shape.get()].images) {
|
||||||
if (std::abs((int)(image->side - info.size)) > leaderVal)
|
if (std::abs((int)(image->side - IDEALSIDE)) > leaderVal)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
leaderVal = image->side;
|
leaderVal = image->side;
|
||||||
|
@ -498,7 +500,7 @@ bool CHyprcursorManager::loadThemeStyle(const SCursorStyleInfo& info) {
|
||||||
|
|
||||||
Debug::log(HC_LOG_TRACE, logFn, "loadThemeStyle: png shape {} has {} frames", shape->directory, FRAMES.size());
|
Debug::log(HC_LOG_TRACE, logFn, "loadThemeStyle: png shape {} has {} frames", shape->directory, FRAMES.size());
|
||||||
|
|
||||||
const int PIXELSIDE = std::round(info.size / shape->nominalSize);
|
const int PIXELSIDE = std::round(leader->side / shape->nominalSize);
|
||||||
|
|
||||||
Debug::log(HC_LOG_TRACE, logFn, "loadThemeStyle: png shape has nominal {:.2f}, pixel size will be {}x", shape->nominalSize, PIXELSIDE);
|
Debug::log(HC_LOG_TRACE, logFn, "loadThemeStyle: png shape has nominal {:.2f}, pixel size will be {}x", shape->nominalSize, PIXELSIDE);
|
||||||
|
|
||||||
|
@ -566,7 +568,7 @@ bool CHyprcursorManager::loadThemeStyle(const SCursorStyleInfo& info) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsvgRectangle rect = {0, 0, (double)info.size, (double)info.size};
|
RsvgRectangle rect = {0, 0, (double)PIXELSIDE, (double)PIXELSIDE};
|
||||||
|
|
||||||
if (!rsvg_handle_render_document(handle, PCAIRO, &rect, &error)) {
|
if (!rsvg_handle_render_document(handle, PCAIRO, &rect, &error)) {
|
||||||
Debug::log(HC_LOG_ERR, logFn, "Failed rendering svg: {}", error->message);
|
Debug::log(HC_LOG_ERR, logFn, "Failed rendering svg: {}", error->message);
|
||||||
|
|
Loading…
Reference in a new issue