diff --git a/src/core/CursorShape.cpp b/src/core/CursorShape.cpp index ff91f9a..25016dd 100644 --- a/src/core/CursorShape.cpp +++ b/src/core/CursorShape.cpp @@ -8,13 +8,13 @@ CCursorShape::CCursorShape(wp_cursor_shape_manager_v1* mgr) : mgr(mgr) { dev = wp_cursor_shape_manager_v1_get_pointer(mgr, g_pHyprlock->m_pPointer); } -void CCursorShape::setShape(const uint32_t serial, const wp_cursor_shape_device_v1_shape shape) { +void CCursorShape::setShape(const wp_cursor_shape_device_v1_shape shape) { if (!dev) return; - wp_cursor_shape_device_v1_set_shape(dev, serial, shape); + wp_cursor_shape_device_v1_set_shape(dev, lastCursorSerial, shape); } -void CCursorShape::hideCursor(const uint32_t serial) { - wl_pointer_set_cursor(g_pHyprlock->m_pPointer, serial, nullptr, 0, 0); +void CCursorShape::hideCursor() { + wl_pointer_set_cursor(g_pHyprlock->m_pPointer, lastCursorSerial, nullptr, 0, 0); } \ No newline at end of file diff --git a/src/core/CursorShape.hpp b/src/core/CursorShape.hpp index fd00df0..c0d858b 100644 --- a/src/core/CursorShape.hpp +++ b/src/core/CursorShape.hpp @@ -7,8 +7,10 @@ class CCursorShape { public: CCursorShape(wp_cursor_shape_manager_v1* mgr); - void setShape(const uint32_t serial, const wp_cursor_shape_device_v1_shape shape); - void hideCursor(const uint32_t serial); + void setShape(const wp_cursor_shape_device_v1_shape shape); + void hideCursor(); + + uint32_t lastCursorSerial = 0; private: wp_cursor_shape_manager_v1* mgr = nullptr; diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index a61886d..e2ec08b 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -626,10 +626,12 @@ static void handlePointerEnter(void* data, struct wl_pointer* wl_pointer, uint32 static auto* const PHIDE = (Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:hide_cursor"); + g_pHyprlock->m_pCursorShape->lastCursorSerial = serial; + if (**PHIDE) - g_pHyprlock->m_pCursorShape->hideCursor(serial); + g_pHyprlock->m_pCursorShape->hideCursor(); else - g_pHyprlock->m_pCursorShape->setShape(serial, wp_cursor_shape_device_v1_shape::WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER); + g_pHyprlock->m_pCursorShape->setShape(wp_cursor_shape_device_v1_shape::WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT); g_pHyprlock->m_vLastEnterCoords = {wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)}; } @@ -643,6 +645,8 @@ static void handlePointerAxis(void* data, wl_pointer* wl_pointer, uint32_t time, } static void handlePointerMotion(void* data, struct wl_pointer* wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { + static auto* const PHIDE = (Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:hide_cursor"); + if (std::chrono::system_clock::now() > g_pHyprlock->m_tGraceEnds) return; diff --git a/src/renderer/Renderer.hpp b/src/renderer/Renderer.hpp index edc8815..66bb844 100644 --- a/src/renderer/Renderer.hpp +++ b/src/renderer/Renderer.hpp @@ -28,13 +28,13 @@ class CRenderer { float boostA = 1.0; }; - SRenderFeedback renderLock(const CSessionLockSurface& surface); + SRenderFeedback renderLock(const CSessionLockSurface& surface); - void renderRect(const CBox& box, const CColor& col, int rounding = 0); - void renderBorder(const CBox& box, const CGradientValueData& gradient, int thickness, int rounding = 0, float alpha = 1.0); - void renderTexture(const CBox& box, const CTexture& tex, float a = 1.0, int rounding = 0, std::optional tr = {}); - void renderTextureMix(const CBox& box, const CTexture& tex, const CTexture& tex2, float a = 1.0, float mixFactor = 0.0, int rounding = 0, std::optional tr = {}); - void blurFB(const CFramebuffer& outfb, SBlurParams params); + void renderRect(const CBox& box, const CColor& col, int rounding = 0); + void renderBorder(const CBox& box, const CGradientValueData& gradient, int thickness, int rounding = 0, float alpha = 1.0); + void renderTexture(const CBox& box, const CTexture& tex, float a = 1.0, int rounding = 0, std::optional tr = {}); + void renderTextureMix(const CBox& box, const CTexture& tex, const CTexture& tex2, float a = 1.0, float mixFactor = 0.0, int rounding = 0, std::optional tr = {}); + void blurFB(const CFramebuffer& outfb, SBlurParams params); std::unique_ptr asyncResourceGatherer; std::chrono::system_clock::time_point firstFullFrameTime;