From beee22a95ed9044950e5486f22edd813e00ffa2c Mon Sep 17 00:00:00 2001 From: Kamikadze <40305144+Kam1k4dze@users.noreply.github.com> Date: Thu, 14 Aug 2025 19:44:56 +0500 Subject: refactor: Use new hyprutils casts (#11377) --- src/managers/CursorManager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/managers/CursorManager.cpp') 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 self, void* data) { - const auto cursorMgr = reinterpret_cast(data); + const auto cursorMgr = sc(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*)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(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(pixelData, pixelData + ((int)size_.y * m_stride)); + m_data = std::vector(pixelData, pixelData + (sc(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((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot); + auto buf = makeShared(rc(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(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((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot); + auto buf = makeShared(rc(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(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(icon.pixels.data()), icon.size.x * 4, icon.size, icon.hotspot); } } -- cgit v1.2.3