mirror of
https://github.com/virtcode/hypr-dynamic-cursors
synced 2025-09-20 00:23:22 +02:00
fix: clamp padding to integer value
This commit is contained in:
parent
ee5f66775a
commit
f0409be765
1 changed files with 3 additions and 3 deletions
|
@ -112,7 +112,7 @@ void CDynamicCursors::damageSoftware(CPointerManager* pointers) {
|
||||||
// we damage a padding of the diagonal around the hotspot, to accomodate for all possible hotspots and rotations
|
// we damage a padding of the diagonal around the hotspot, to accomodate for all possible hotspots and rotations
|
||||||
auto zoom = resultShown.scale;
|
auto zoom = resultShown.scale;
|
||||||
Vector2D size = pointers->currentCursorImage.size / pointers->currentCursorImage.scale * zoom;
|
Vector2D size = pointers->currentCursorImage.size / pointers->currentCursorImage.scale * zoom;
|
||||||
float diagonal = size.size();
|
int diagonal = size.size();
|
||||||
Vector2D padding = {diagonal, diagonal};
|
Vector2D padding = {diagonal, diagonal};
|
||||||
|
|
||||||
CBox b = CBox{pointers->pointerPos, size + (padding * 2)}.translate(-(pointers->currentCursorImage.hotspot * zoom + padding));
|
CBox b = CBox{pointers->pointerPos, size + (padding * 2)}.translate(-(pointers->currentCursorImage.hotspot * zoom + padding));
|
||||||
|
@ -142,7 +142,7 @@ wlr_buffer* CDynamicCursors::renderHardware(CPointerManager* pointers, SP<CPoint
|
||||||
auto zoom = resultShown.scale;
|
auto zoom = resultShown.scale;
|
||||||
|
|
||||||
auto size = pointers->currentCursorImage.size * zoom;
|
auto size = pointers->currentCursorImage.size * zoom;
|
||||||
float diagonal = size.size();
|
int diagonal = size.size();
|
||||||
Vector2D padding = {diagonal, diagonal};
|
Vector2D padding = {diagonal, diagonal};
|
||||||
|
|
||||||
// we try to allocate a buffer with padding, see software damage
|
// we try to allocate a buffer with padding, see software damage
|
||||||
|
@ -232,7 +232,7 @@ bool CDynamicCursors::setHardware(CPointerManager* pointers, SP<CPointerManager:
|
||||||
if (!P_MONITOR->output->cursor_swapchain) return false;
|
if (!P_MONITOR->output->cursor_swapchain) return false;
|
||||||
|
|
||||||
// we need to transform the hotspot manually as we need to indent it by the padding
|
// we need to transform the hotspot manually as we need to indent it by the padding
|
||||||
float diagonal = pointers->currentCursorImage.size.size();
|
int diagonal = pointers->currentCursorImage.size.size();
|
||||||
Vector2D padding = {diagonal, diagonal};
|
Vector2D padding = {diagonal, diagonal};
|
||||||
|
|
||||||
const auto HOTSPOT = CBox{((pointers->currentCursorImage.hotspot * P_MONITOR->scale) + padding) * resultShown.scale, {0, 0}}
|
const auto HOTSPOT = CBox{((pointers->currentCursorImage.hotspot * P_MONITOR->scale) + padding) * resultShown.scale, {0, 0}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue