From c8d69b5d70f07cc7d037fcd6ac3d0d2f1c7f512b Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 26 Jun 2020 15:01:30 +0200 Subject: [PATCH] Added the single drawable buffer patch as per the FAQ in order to get w3m images to display --- README.md | 2 ++ patches.def.h | 6 ++++++ x.c | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 94810c0..62728ca 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the ### Changelog: +2020-06-26 - Added the single drawable buffer patch as per the FAQ in order to get w3m images to display + 2020-06-25 - Upgrade to 0.8.4 (367803, 2020-06-19) 2020-06-14 - Added w3m patch diff --git a/patches.def.h b/patches.def.h index 2634cf9..d1ff317 100644 --- a/patches.def.h +++ b/patches.def.h @@ -177,6 +177,12 @@ */ #define SCROLLBACK_MOUSE_ALTSCREEN_PATCH 0 +/* This is the single drawable buffer patch as outlined in the FAQ to get images + * in w3m to display. While this patch does not break the alpha patch it images + * are not shown in w3m if the alpha patch is applied. + */ +#define SINGLE_DRAWABLE_BUFFER_PATCH 0 + /* This patch allows clients to embed into the st window and is useful if you tend to * start X applications from the terminal. For example: * diff --git a/x.c b/x.c index 1f4114c..6ea6c44 100644 --- a/x.c +++ b/x.c @@ -816,6 +816,7 @@ xresize(int col, int row) win.tw = col * win.cw; win.th = row * win.ch; + #if !SINGLE_DRAWABLE_BUFFER_PATCH XFreePixmap(xw.dpy, xw.buf); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, #if ALPHA_PATCH @@ -825,6 +826,7 @@ xresize(int col, int row) #endif // ALPHA_PATCH ); XftDrawChange(xw.draw, xw.buf); + #endif // SINGLE_DRAWABLE_BUFFER_PATCH xclear(0, 0, win.w, win.h); /* resize to new width */ @@ -1333,13 +1335,21 @@ xinit(int cols, int rows) gcvalues.graphics_exposures = False; #if ALPHA_PATCH + #if SINGLE_DRAWABLE_BUFFER_PATCH + xw.buf = xw.win; + #else xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); + #endif // SINGLE_DRAWABLE_BUFFER_PATCH dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); #else dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues); + #if SINGLE_DRAWABLE_BUFFER_PATCH + xw.buf = xw.win; + #else xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); + #endif // SINGLE_DRAWABLE_BUFFER_PATCH #endif // ALPHA_PATCH XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); @@ -1999,8 +2009,10 @@ xfinishdraw(void) if (vbellmode == 3 && win.vbellset) xdrawvbell(); #endif // VISUALBELL_3_PATCH + #if !SINGLE_DRAWABLE_BUFFER_PATCH XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w, win.h, 0, 0); + #endif // SINGLE_DRAWABLE_BUFFER_PATCH XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg].pixel);