summaryrefslogtreecommitdiff
path: root/src/managers/CursorManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/managers/CursorManager.cpp')
-rw-r--r--src/managers/CursorManager.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/managers/CursorManager.cpp b/src/managers/CursorManager.cpp
index 84e2e6d8..442da443 100644
--- a/src/managers/CursorManager.cpp
+++ b/src/managers/CursorManager.cpp
@@ -7,7 +7,7 @@
#include "../helpers/Monitor.hpp"
static int cursorAnimTimer(SP<CEventLoopTimer> self, void* data) {
- const auto cursorMgr = reinterpret_cast<CCursorManager*>(data);
+ const auto cursorMgr = sc<CCursorManager*>(data);
cursorMgr->tickAnimatedCursor();
return 1;
}
@@ -22,13 +22,13 @@ static void hcLogger(enum eHyprcursorLogLevel level, char* message) {
CCursorBuffer::CCursorBuffer(cairo_surface_t* surf, const Vector2D& size_, const Vector2D& hot_) : m_hotspot(hot_), m_stride(cairo_image_surface_get_stride(surf)) {
size = size_;
- m_data = std::vector<uint8_t>((uint8_t*)cairo_image_surface_get_data(surf), ((uint8_t*)cairo_image_surface_get_data(surf)) + (cairo_image_surface_get_height(surf) * m_stride));
+ m_data = std::vector<uint8_t>(cairo_image_surface_get_data(surf), cairo_image_surface_get_data(surf) + (cairo_image_surface_get_height(surf) * m_stride));
}
CCursorBuffer::CCursorBuffer(const uint8_t* pixelData, const Vector2D& size_, const Vector2D& hot_) : m_hotspot(hot_), m_stride(4 * size_.x) {
size = size_;
- m_data = std::vector<uint8_t>(pixelData, pixelData + ((int)size_.y * m_stride));
+ m_data = std::vector<uint8_t>(pixelData, pixelData + (sc<int>(size_.y) * m_stride));
}
Aquamarine::eBufferCapability CCursorBuffer::caps() {
@@ -167,7 +167,7 @@ void CCursorManager::setCursorFromName(const std::string& name) {
auto xcursor = m_xcursor->getShape(name, m_size, m_cursorScale);
auto& icon = xcursor->images.front();
- auto buf = makeShared<CCursorBuffer>((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot);
+ auto buf = makeShared<CCursorBuffer>(rc<uint8_t*>(icon.pixels.data()), icon.size, icon.hotspot);
setCursorBuffer(buf, icon.hotspot / scale, scale);
m_currentXcursor = xcursor;
@@ -233,18 +233,18 @@ void CCursorManager::tickAnimatedCursor() {
if (!m_hyprcursor->valid() && m_currentXcursor->images.size() > 1) {
m_currentAnimationFrame++;
- if ((size_t)m_currentAnimationFrame >= m_currentXcursor->images.size())
+ if (sc<size_t>(m_currentAnimationFrame) >= m_currentXcursor->images.size())
m_currentAnimationFrame = 0;
float scale = std::ceil(m_cursorScale);
auto& icon = m_currentXcursor->images.at(m_currentAnimationFrame);
- auto buf = makeShared<CCursorBuffer>((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot);
+ auto buf = makeShared<CCursorBuffer>(rc<uint8_t*>(icon.pixels.data()), icon.size, icon.hotspot);
setCursorBuffer(buf, icon.hotspot / scale, scale);
setAnimationTimer(m_currentAnimationFrame, m_currentXcursor->images[m_currentAnimationFrame].delay);
} else if (m_currentCursorShapeData.images.size() > 1) {
m_currentAnimationFrame++;
- if ((size_t)m_currentAnimationFrame >= m_currentCursorShapeData.images.size())
+ if (sc<size_t>(m_currentAnimationFrame) >= m_currentCursorShapeData.images.size())
m_currentAnimationFrame = 0;
auto hotspot =
@@ -281,7 +281,7 @@ void CCursorManager::setXWaylandCursor() {
auto xcursor = m_xcursor->getShape("left_ptr", m_size, 1);
auto& icon = xcursor->images.front();
- g_pXWayland->setCursor((uint8_t*)icon.pixels.data(), icon.size.x * 4, icon.size, icon.hotspot);
+ g_pXWayland->setCursor(rc<uint8_t*>(icon.pixels.data()), icon.size.x * 4, icon.size, icon.hotspot);
}
}