Adding alpha gradient patch

This commit is contained in:
bakkeby 2021-02-15 14:37:37 +01:00
parent a23971fff1
commit 99903c67d9
4 changed files with 20 additions and 3 deletions

View File

@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog: ### Changelog:
2021-02-15 - Added the alpha gradient patch
2020-11-14 - Added the wide glyphs patch 2020-11-14 - Added the wide glyphs patch
2020-10-23 - Added the monochrome patch 2020-10-23 - Added the monochrome patch
@ -99,6 +101,10 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [~force-redraw-after-keypress~](https://lists.suckless.org/hackers/2004/17221.html) - [~force-redraw-after-keypress~](https://lists.suckless.org/hackers/2004/17221.html)
- ~this patch forces the terminal to check for new data on the tty on keypress with the aim of reducing input latency~ - ~this patch forces the terminal to check for new data on the tty on keypress with the aim of reducing input latency~
- [gradient](https://st.suckless.org/patches/gradient/)
- adds gradient transparency to st
- depends on the alpha patch
- [hidecursor](https://st.suckless.org/patches/hidecursor/) - [hidecursor](https://st.suckless.org/patches/hidecursor/)
- hides the X cursor whenever a key is pressed and show it back when the mouse is moved in the terminal window - hides the X cursor whenever a key is pressed and show it back when the mouse is moved in the terminal window

View File

@ -124,6 +124,10 @@ unsigned int tabspaces = 8;
#if ALPHA_PATCH #if ALPHA_PATCH
/* bg opacity */ /* bg opacity */
float alpha = 0.8; float alpha = 0.8;
#if ALPHA_GRADIENT_PATCH
float grad_alpha = 0.54; //alpha value that'll change
float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha
#endif // ALPHA_GRADIENT_PATCH
#endif // ALPHA_PATCH #endif // ALPHA_PATCH
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */

View File

@ -13,7 +13,7 @@ X11LIB = /usr/X11R6/lib
PKG_CONFIG = pkg-config PKG_CONFIG = pkg-config
# Uncomment this for the alpha patch / ALPHA_PATCH # Uncomment this for the alpha patch / ALPHA_PATCH
#XRENDER = -lXrender XRENDER = -lXrender
# Uncomment this for the themed cursor patch / THEMED_CURSOR_PATCH # Uncomment this for the themed cursor patch / THEMED_CURSOR_PATCH
#XCURSOR = -lXcursor #XCURSOR = -lXcursor
@ -36,8 +36,8 @@ STLDFLAGS = $(LIBS) $(LDFLAGS)
# OpenBSD: # OpenBSD:
#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE #CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \ #LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
# `$(PKG_CONFIG) --libs fontconfig` \ # `pkg-config --libs fontconfig` \
# `$(PKG_CONFIG) --libs freetype2` # `pkg-config --libs freetype2`
# compiler and linker # compiler and linker
# CC = c99 # CC = c99

7
x.c
View File

@ -1729,6 +1729,13 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
} }
#endif // INVERT_PATCH #endif // INVERT_PATCH
#if ALPHA_PATCH && ALPHA_GRADIENT_PATCH
// gradient
bg->color.alpha = grad_alpha * 0xffff * (win.h - y*win.ch) / win.h + stat_alpha * 0xffff;
// uncomment to invert the gradient
// bg->color.alpha = grad_alpha * 0xffff * (y*win.ch) / win.h + stat_alpha * 0xffff;
#endif // ALPHA_PATCH | ALPHA_GRADIENT_PATCH
#if WIDE_GLYPHS_PATCH #if WIDE_GLYPHS_PATCH
if (dmode & DRAW_BG) { if (dmode & DRAW_BG) {
#endif // WIDE_GLYPHS_PATCH #endif // WIDE_GLYPHS_PATCH