mirror of
https://github.com/hyprwm/hyprlock.git
synced 2025-02-03 16:29:48 +01:00
core: clean up pointer logic and clang-format
This commit is contained in:
parent
d94cc3a5ab
commit
77d194c1e9
4 changed files with 20 additions and 14 deletions
|
@ -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);
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<eTransform> 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<eTransform> 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<eTransform> 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<eTransform> tr = {});
|
||||
void blurFB(const CFramebuffer& outfb, SBlurParams params);
|
||||
|
||||
std::unique_ptr<CAsyncResourceGatherer> asyncResourceGatherer;
|
||||
std::chrono::system_clock::time_point firstFullFrameTime;
|
||||
|
|
Loading…
Reference in a new issue