core: fix the zoom bubble showing without coords (#133)

This commit is contained in:
Sepandar 2025-06-14 13:09:29 +00:00 committed by GitHub
parent 68bc7875fd
commit 166dce0fae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -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);
@ -614,6 +614,7 @@ void CHyprpicker::initMouse() {
auto y = wl_fixed_to_double(surface_y);
m_vLastCoords = {x, y};
m_bCoordsInitialized = true;
for (auto& ls : m_vLayerSurfaces) {
if (ls->pSurface->resource() == surface) {

View file

@ -56,6 +56,7 @@ class CHyprpicker {
CLayerSurface* m_pLastSurface;
Vector2D m_vLastCoords;
bool m_bCoordsInitialized = false;
void renderSurface(CLayerSurface*, bool forceInactive = false);