hypr-chrome v0.1.4 #16

Merged
darman merged 5 commits from develop into master 2026-08-04 16:01:16 +02:00
2 changed files with 26 additions and 2 deletions
Showing only changes of commit 74ec7c89f0 - Show all commits
+6 -1
View File
@@ -460,7 +460,12 @@ void ChromeDecoration::damageEntire() {
// The shadow hangs outside the decoration's own box (it's drawn, not // The shadow hangs outside the decoration's own box (it's drawn, not
// reserved - see ShadowMarginLogical), so damaging just that box would // reserved - see ShadowMarginLogical), so damaging just that box would
// leave its outer reaches stale. // 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() { double ChromeDecoration::ShadowMarginLogical() {
+20 -1
View File
@@ -21,7 +21,26 @@ std::vector<UP<IPassElement>> ChromePassElement::draw() {
return {}; return {};
auto box = data.decoration->FullDecorationExtentGlobal(); 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) if (box.w < 1 || box.h < 1)
return {}; return {};