From 0d2a8963fcb27c2e69b36dd37436dc9be8ddf179 Mon Sep 17 00:00:00 2001 From: Sepandar Date: Wed, 11 Jun 2025 16:13:01 -0700 Subject: [PATCH] Partial fix --- src/hyprpicker.cpp | 9 +++++---- src/hyprpicker.hpp | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hyprpicker.cpp b/src/hyprpicker.cpp index 07f69db..15b3b84 100644 --- a/src/hyprpicker.cpp +++ b/src/hyprpicker.cpp @@ -364,7 +364,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) { cairo_rectangle(PCAIRO, 0, 0, PBUFFER->pixelSize.x, PBUFFER->pixelSize.y); cairo_fill(PCAIRO); - if (pSurface == m_pLastSurface && !forceInactive) { + if (pSurface == m_pLastSurface && !forceInactive && m_bCoordsInitialized) { const auto SCALEBUFS = pSurface->screenBuffer->pixelSize / PBUFFER->pixelSize; const auto MOUSECOORDSABS = m_vLastCoords.floor() / pSurface->m_pMonitor->size; const auto CLICKPOS = MOUSECOORDSABS * PBUFFER->pixelSize; @@ -514,12 +514,12 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) { cairo_restore(PCAIRO); cairo_pattern_destroy(PATTERN); } - } else if (!m_bRenderInactive) { + } else if (!m_bRenderInactive && m_bCoordsInitialized) { cairo_set_operator(PCAIRO, CAIRO_OPERATOR_SOURCE); cairo_set_source_rgba(PCAIRO, 0, 0, 0, 0); cairo_rectangle(PCAIRO, 0, 0, PBUFFER->pixelSize.x, PBUFFER->pixelSize.y); cairo_fill(PCAIRO); - } else { + } else if (m_bCoordsInitialized) { const auto SCALEBUFS = pSurface->screenBuffer->pixelSize / PBUFFER->pixelSize; const auto PATTERNPRE = cairo_pattern_create_for_surface(pSurface->screenBuffer->surface); cairo_pattern_set_filter(PATTERNPRE, CAIRO_FILTER_BILINEAR); @@ -613,7 +613,8 @@ void CHyprpicker::initMouse() { auto x = wl_fixed_to_double(surface_x); auto y = wl_fixed_to_double(surface_y); - m_vLastCoords = {x, y}; + m_vLastCoords = {x, y}; + m_bCoordsInitialized = true; for (auto& ls : m_vLayerSurfaces) { if (ls->pSurface->resource() == surface) { diff --git a/src/hyprpicker.hpp b/src/hyprpicker.hpp index 0453f61..f577dfe 100644 --- a/src/hyprpicker.hpp +++ b/src/hyprpicker.hpp @@ -56,6 +56,7 @@ class CHyprpicker { CLayerSurface* m_pLastSurface; Vector2D m_vLastCoords; + bool m_bCoordsInitialized = false; void renderSurface(CLayerSurface*, bool forceInactive = false);