[wiki] [sites] [st][patch][background_image] minor corrections || Matthias Schoth
commit a55a26af3e49b702d1c479a02423884fa50b2acf
Author: Matthias Schoth <mschoth_AT_gmail.com>
Date: Sun Jul 4 19:23:42 2021 +0200
[st][patch][background_image] minor corrections
- remove redundant drawable
- close file after init
- don't cat into pipe
diff --git a/st.suckless.org/patches/background_image/index.md b/st.suckless.org/patches/background_image/index.md
index e5956112..49c88c63 100644
--- a/st.suckless.org/patches/background_image/index.md
+++ b/st.suckless.org/patches/background_image/index.md
_AT_@ -26,7 +26,7 @@ effects can be applied to the desktop background in an automated fashion.
Pictured below is an example of the result of a darken and blur operation
invoked with the following command:
- cat wallpaper.jpg | jpg2ff | ff-border e 50 | ff-bright rgba 0 0.5 1 | ff-blur 50 15 > st_wallpaper.ff
+ jpg2ff < wallpaper.jpg | ff-border e 50 | ff-bright rgba 0 0.5 1 | ff-blur 50 15 > st_wallpaper.ff
![Screenshot](pseudo-transparency.png)
diff --git a/st.suckless.org/patches/background_image/st-background-image-0.8.4.diff b/st.suckless.org/patches/background_image/st-background-image-0.8.4.diff
index 6bbabc54..8a6b7bf1 100644
--- a/st.suckless.org/patches/background_image/st-background-image-0.8.4.diff
+++ b/st.suckless.org/patches/background_image/st-background-image-0.8.4.diff
_AT_@ -1,12 +1,12 @@
-From a92db07df3cd81ee51ac9650b65adb8685e52187 Mon Sep 17 00:00:00 2001
+From fdf9692358326993f0dc6a6896cc0a7194ba6152 Mon Sep 17 00:00:00 2001
From: Matthias Schoth <mschoth_AT_gmail.com>
-Date: Sat, 24 Apr 2021 21:24:41 +0200
+Date: Sun, 4 Jul 2021 19:18:20 +0200
Subject: [PATCH] Implements background image and pseudo transparancy support.
---
config.def.h | 8 +++++
- x.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++----
- 2 files changed, 95 insertions(+), 6 deletions(-)
+ x.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++----
+ 2 files changed, 93 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index 6f05dce..3d352db 100644
_AT_@ -28,7 +28,7 @@ index 6f05dce..3d352db 100644
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
diff --git a/x.c b/x.c
-index 210f184..400cceb 100644
+index 210f184..22653ea 100644
--- a/x.c
+++ b/x.c
_AT_@ -14,6 +14,7 @@
_AT_@ -47,17 +47,16 @@ index 210f184..400cceb 100644
int ch; /* char height */
int cw; /* char width */
int mode; /* window state/mode flags */
-_AT_@ -101,6 +103,9 @@ typedef struct {
+_AT_@ -101,6 +103,8 @@ typedef struct {
XVaNestedList spotlist;
} ime;
Draw draw;
-+ Drawable xftdraw; /* buffer that xft draws to */
+ Drawable bgimg; /* background image */
+ GC bggc; /* Graphics Context for background */
Visual *vis;
XSetWindowAttributes attrs;
int scr;
-_AT_@ -151,6 +156,7 @@ static void ximinstantiate(Display *, XPointer, XPointer);
+_AT_@ -151,6 +155,7 @@ static void ximinstantiate(Display *, XPointer, XPointer);
static void ximdestroy(XIM, XPointer, XPointer);
static int xicdestroy(XIC, XPointer, XPointer);
static void xinit(int, int);
_AT_@ -65,15 +64,7 @@ index 210f184..400cceb 100644
static void cresize(int, int);
static void xresize(int, int);
static void xhints(void);
-_AT_@ -736,6 +742,7 @@ xresize(int col, int row)
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
- DefaultDepth(xw.dpy, xw.scr));
- XftDrawChange(xw.draw, xw.buf);
-+ xw.xftdraw = XftDrawDrawable(xw.draw);
- xclear(0, 0, win.w, win.h);
-
- /* resize to new width */
-_AT_@ -820,9 +827,9 @@ xsetcolorname(int x, const char *name)
+_AT_@ -820,9 +825,9 @@ xsetcolorname(int x, const char *name)
void
xclear(int x1, int y1, int x2, int y2)
{
_AT_@ -82,19 +73,11 @@ index 210f184..400cceb 100644
- x1, y1, x2-x1, y2-y1);
+ if (pseudotransparency)
+ XSetTSOrigin(xw.dpy, xw.bggc, -win.x, -win.y);
-+ XFillRectangle(xw.dpy, xw.xftdraw, xw.bggc, x1, y1, x2-x1, y2-y1);
++ XFillRectangle(xw.dpy, xw.buf, xw.bggc, x1, y1, x2-x1, y2-y1);
}
void
-_AT_@ -1158,6 +1165,7 @@ xinit(int cols, int rows)
-
- /* Xft rendering context */
- xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
-+ xw.xftdraw = XftDrawDrawable(xw.draw);
-
- /* input methods */
- if (!ximopen(xw.dpy)) {
-_AT_@ -1207,6 +1215,64 @@ xinit(int cols, int rows)
+_AT_@ -1207,6 +1212,65 @@ xinit(int cols, int rows)
xsel.xtarget = XA_STRING;
}
_AT_@ -138,6 +121,7 @@ index 210f184..400cceb 100644
+ image32[i++] = buf[6];
+ }
+
++ fclose(bgf);
+ bgxi = XCreateImage(xw.dpy, DefaultVisual(xw.dpy, xw.scr),
+ 24, ZPixmap, 0, image32, bgw, bgh, 32, 0);
+ xw.bgimg = XCreatePixmap(xw.dpy, xw.win, bgw, bgh,
_AT_@ -159,7 +143,7 @@ index 210f184..400cceb 100644
int
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
{
-_AT_@ -1447,7 +1513,10 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
+_AT_@ -1447,7 +1511,10 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
xclear(winx, winy + win.ch, winx + width, win.h);
/* Clean up the region we want to draw to. */
_AT_@ -171,7 +155,7 @@ index 210f184..400cceb 100644
/* Set the clip region because Xft is sometimes dirty. */
r.x = 0;
-_AT_@ -1855,8 +1924,19 @@ cmessage(XEvent *e)
+_AT_@ -1855,8 +1922,19 @@ cmessage(XEvent *e)
void
resize(XEvent *e)
{
_AT_@ -193,7 +177,7 @@ index 210f184..400cceb 100644
cresize(e->xconfigure.width, e->xconfigure.height);
}
-_AT_@ -2041,6 +2121,7 @@ run:
+_AT_@ -2041,6 +2119,7 @@ run:
rows = MAX(rows, 1);
tnew(cols, rows);
xinit(cols, rows);
_AT_@ -202,5 +186,5 @@ index 210f184..400cceb 100644
selinit();
run();
--
-2.31.1
+2.32.0
Received on Sun Jul 04 2021 - 19:31:29 CEST
This archive was generated by hypermail 2.3.0
: Sun Jul 04 2021 - 19:36:42 CEST