diff --git a/src/main.cpp b/src/main.cpp index 58f5bcc..6a6077d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -78,14 +78,11 @@ void tick(SP self, void* data) { if (not shouldErase) { const CBox windowBox = window->getFullWindowBoundingBox(); - const CBox wobbleBox = wobble.getBox(); + CBox wobbleBox = wobble.getBox(); + wobbleBox.scale(Vector2D {windowBox.width, windowBox.height}); + wobbleBox.translate(Vector2D {windowBox.x, windowBox.y}); - g_pHyprRenderer->damageBox(CBox( - windowBox.x + windowBox.width * wobbleBox.x, - windowBox.y + windowBox.height * wobbleBox.y, - windowBox.width * wobbleBox.width, - windowBox.height * wobbleBox.height - )); + g_pHyprRenderer->damageBox(wobbleBox); } return shouldErase; @@ -135,6 +132,8 @@ void hkRenderWindow( // did the window move if (const auto pos = pWindow->m_realPosition->value(); pos != g_windowPositions[pWindow]) { + scheduleTick(); + auto&& wobble = g_wobblyWindows[pWindow]; const auto windowBox = pWindow->getFullWindowBoundingBox(); @@ -162,9 +161,6 @@ void hkRenderWindow( const auto windowBox = pWindow->getFullWindowBoundingBox(); if (shouldWobble) { - if (not g_tickScheduled) - scheduleTick(); - PHLWINDOWREF ref {pWindow}; // create it if not exists @@ -177,6 +173,9 @@ void hkRenderWindow( // render window at 0,0 (we translate it afterward) pWindow->m_floatingOffset -= Vector2D {windowBox.x, windowBox.y}; + // HACK: otherwise renderWindow will set an opaque region at top-left + pWindow->m_activeInactiveAlpha->setValueAndWarp(0.999f); + pRenderer->m_renderPass.add(makeUnique(&windowFB)); } @@ -195,6 +194,9 @@ void hkRenderWindow( if (shouldWobble) { pWindow->m_floatingOffset += Vector2D {windowBox.x, windowBox.y}; + // FIXME: restore full opacity, which is uh wrong + pWindow->m_activeInactiveAlpha->setValueAndWarp(1.f); + pRenderer->m_renderPass.add( makeUnique(pOldFramebuffer, pWindow) );