From 025f6344d97a828cc4b507ddef64b9ea77805291 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:00:14 +0900 Subject: modified st/x.c --- st/x.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/st/x.c b/st/x.c index 45033b6..0f11bf4 100644 --- a/st/x.c +++ b/st/x.c @@ -1596,14 +1596,18 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x void chgalpha(const Arg *arg) { - if (arg->f == -1.0f && alpha >= 0.1f) - alpha -= 0.1f; - else if (arg->f == 1.0f && alpha < 1.0f) - alpha += 0.1f; - else if (arg->f == 0.0f) - alpha = alpha_def; - else - return; + if (arg->f == 0.0f) { + /* reset */ + alpha = alpha_def; + } else { + /* relative change: clamp to [0,1] */ + float newα = alpha + arg->f; + if (newα < 0.0f) + newα = 0.0f; + else if (newα > 1.0f) + newα = 1.0f; + alpha = newα; + } dc.col[defaultbg].color.alpha = (unsigned short)(0xFFFF * alpha); /* Required to remove artifacting from borderpx */ -- cgit v1.2.3