diff --git a/src/ChromeDecoration.cpp b/src/ChromeDecoration.cpp index 627f9b7..eb2a7cc 100644 --- a/src/ChromeDecoration.cpp +++ b/src/ChromeDecoration.cpp @@ -460,7 +460,12 @@ void ChromeDecoration::damageEntire() { // The shadow hangs outside the decoration's own box (it's drawn, not // reserved - see ShadowMarginLogical), so damaging just that box would // leave its outer reaches stale. - g_pHyprRenderer->damageBox(FullDecorationExtentGlobal().expand(ShadowMarginLogical())); + // + // The extra pixel covers the gap ChromePassElement::draw()'s rounding can + // open: it rounds the device-space position and size separately, so the + // box's far edge can land up to a device pixel past where this logical box + // scales to. One logical px is at least that much on any scale >= 1. + g_pHyprRenderer->damageBox(FullDecorationExtentGlobal().expand(ShadowMarginLogical() + 1.0)); } double ChromeDecoration::ShadowMarginLogical() { diff --git a/src/ChromePassElement.cpp b/src/ChromePassElement.cpp index df3e4a1..f757dca 100644 --- a/src/ChromePassElement.cpp +++ b/src/ChromePassElement.cpp @@ -21,7 +21,26 @@ std::vector> ChromePassElement::draw() { return {}; auto box = data.decoration->FullDecorationExtentGlobal(); - box.translate(-monitor->m_position).scale(monitor->m_scale).round(); + box.translate(-monitor->m_position).scale(monitor->m_scale); + + // Round the position and the size independently, rather than via + // CBox::round(). That derives the size from the two *rounded corners* + // (round(x + w) - round(x)), which makes it a function of the position's + // fractional part - so a box that is merely sliding, at a perfectly + // constant size, has its rounded w/h flip by a pixel every few frames. + // Every one of those flips misses the caches in GetBorderTexture / + // GetShadowTexture / GetTitleTexture, each miss being a full cairo + // re-render plus a GPU re-upload of a texture that didn't actually change + // appearance - which is precisely what a workspace switch, a window move, + // or any other position-only animation does, every frame, for every window + // on screen. Rounded on its own, the size stays a pure function of the + // window's own size and can't be perturbed by translation at all. + // + // What round()'s coupling buys is a far edge that lands on the same device + // pixel as an adjacent box's near edge. Nothing abuts this box - it's a + // free-floating decoration drawn over everything - so there is no seam here + // to keep closed. + box = CBox{box.pos().round(), box.size().round()}; if (box.w < 1 || box.h < 1) return {};