mirror of
https://git.allpurposem.at/mat/WiggleWobble.git
synced 2025-12-23 13:01:28 +01:00
fix: pretend window is transparent to remove artifacts at top-left
This commit is contained in:
parent
1351590ece
commit
c6325048e0
22
src/main.cpp
22
src/main.cpp
@ -78,14 +78,11 @@ void tick(SP<CEventLoopTimer> self, void* data) {
|
|||||||
|
|
||||||
if (not shouldErase) {
|
if (not shouldErase) {
|
||||||
const CBox windowBox = window->getFullWindowBoundingBox();
|
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(
|
g_pHyprRenderer->damageBox(wobbleBox);
|
||||||
windowBox.x + windowBox.width * wobbleBox.x,
|
|
||||||
windowBox.y + windowBox.height * wobbleBox.y,
|
|
||||||
windowBox.width * wobbleBox.width,
|
|
||||||
windowBox.height * wobbleBox.height
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return shouldErase;
|
return shouldErase;
|
||||||
@ -135,6 +132,8 @@ void hkRenderWindow(
|
|||||||
|
|
||||||
// did the window move
|
// did the window move
|
||||||
if (const auto pos = pWindow->m_realPosition->value(); pos != g_windowPositions[pWindow]) {
|
if (const auto pos = pWindow->m_realPosition->value(); pos != g_windowPositions[pWindow]) {
|
||||||
|
scheduleTick();
|
||||||
|
|
||||||
auto&& wobble = g_wobblyWindows[pWindow];
|
auto&& wobble = g_wobblyWindows[pWindow];
|
||||||
|
|
||||||
const auto windowBox = pWindow->getFullWindowBoundingBox();
|
const auto windowBox = pWindow->getFullWindowBoundingBox();
|
||||||
@ -162,9 +161,6 @@ void hkRenderWindow(
|
|||||||
const auto windowBox = pWindow->getFullWindowBoundingBox();
|
const auto windowBox = pWindow->getFullWindowBoundingBox();
|
||||||
|
|
||||||
if (shouldWobble) {
|
if (shouldWobble) {
|
||||||
if (not g_tickScheduled)
|
|
||||||
scheduleTick();
|
|
||||||
|
|
||||||
PHLWINDOWREF ref {pWindow};
|
PHLWINDOWREF ref {pWindow};
|
||||||
|
|
||||||
// create it if not exists
|
// create it if not exists
|
||||||
@ -177,6 +173,9 @@ void hkRenderWindow(
|
|||||||
// render window at 0,0 (we translate it afterward)
|
// render window at 0,0 (we translate it afterward)
|
||||||
pWindow->m_floatingOffset -= Vector2D {windowBox.x, windowBox.y};
|
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));
|
pRenderer->m_renderPass.add(makeUnique<CBindOwnFramebufferPassElement>(&windowFB));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +194,9 @@ void hkRenderWindow(
|
|||||||
if (shouldWobble) {
|
if (shouldWobble) {
|
||||||
pWindow->m_floatingOffset += Vector2D {windowBox.x, windowBox.y};
|
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(
|
pRenderer->m_renderPass.add(
|
||||||
makeUnique<CRenderWobblyWindowPassElement>(pOldFramebuffer, pWindow)
|
makeUnique<CRenderWobblyWindowPassElement>(pOldFramebuffer, pWindow)
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user