diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-07-28 16:00:14 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-07-28 16:00:14 +0900 |
| commit | 025f6344d97a828cc4b507ddef64b9ea77805291 (patch) | |
| tree | d2a5fa99368de29370267f12692137f069c02c64 /st/x.c | |
| parent | a350059fa7b50f47edf7f43a28cef8058e990eaa (diff) | |
modified st/x.c
Diffstat (limited to 'st/x.c')
| -rw-r--r-- | st/x.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -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 */ |
