mirror of
https://github.com/hyprwm/hyprpicker.git
synced 2025-12-20 00:10:02 +01:00
core: fix the zoom bubble showing without coords (#133)
This commit is contained in:
parent
68bc7875fd
commit
166dce0fae
2 changed files with 6 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class CHyprpicker {
|
|||
CLayerSurface* m_pLastSurface;
|
||||
|
||||
Vector2D m_vLastCoords;
|
||||
bool m_bCoordsInitialized = false;
|
||||
|
||||
void renderSurface(CLayerSurface*, bool forceInactive = false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue