fix: pretend window is transparent to remove artifacts at top-left

This commit is contained in:
Matias 2025-07-17 15:24:53 +02:00
parent 1351590ece
commit c6325048e0
No known key found for this signature in database
GPG Key ID: ED35A6AC65A06B69

View File

@ -78,14 +78,11 @@ void tick(SP<CEventLoopTimer> 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<CBindOwnFramebufferPassElement>(&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<CRenderWobblyWindowPassElement>(pOldFramebuffer, pWindow)
);