---
st.c | 4 ----
st.h | 4 +---
x.c | 10 +++++++++-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/st.c b/st.c
index 2f0f8ec..2bf9435 100644
--- a/st.c
+++ b/st.c
_AT_@ -176,7 +176,6 @@ static char *base64dec(const char *);
static char base64dec_getc(const char **);
static ssize_t xwrite(int, const char *, size_t);
-static void *xrealloc(void *, size_t);
/* Globals */
Term term;
_AT_@ -2424,9 +2423,6 @@ tresize(int col, int row)
free(term.alt[i]);
}
- /* resize to new width */
- term.specbuf = xrealloc(term.specbuf, col * sizeof(GlyphFontSpec));
-
/* resize to new height */
term.line = xrealloc(term.line, row * sizeof(Line));
term.alt = xrealloc(term.alt, row * sizeof(Line));
diff --git a/st.h b/st.h
index 8d75687..5bd8a01 100644
--- a/st.h
+++ b/st.h
_AT_@ -85,8 +85,6 @@ typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned short ushort;
-typedef XftGlyphFontSpec GlyphFontSpec;
-
typedef uint_least32_t Rune;
#define Glyph Glyph_
_AT_@ -113,7 +111,6 @@ typedef struct {
Line *line; /* screen */
Line *alt; /* alternate screen */
int *dirty; /* dirtyness of lines */
- GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
TCursor c; /* cursor */
int cursor; /* cursor style */
int top; /* top scroll limit */
_AT_@ -215,6 +212,7 @@ size_t utf8decode(char *, Rune *, size_t);
size_t utf8encode(Rune, char *);
void *xmalloc(size_t);
+void *xrealloc(void *, size_t);
char *xstrdup(char *);
/* Globals */
diff --git a/x.c b/x.c
index 45278e0..8abe238 100644
--- a/x.c
+++ b/x.c
_AT_@ -36,6 +36,7 @@ static char *argv0;
typedef XftDraw *Draw;
typedef XftColor Color;
+typedef XftGlyphFontSpec GlyphFontSpec;
/* Purely graphic info */
typedef struct {
_AT_@ -43,6 +44,7 @@ typedef struct {
Colormap cmap;
Window win;
Drawable buf;
+ GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
Atom xembed, wmdeletewin, netwmname, netwmpid;
XIM xim;
XIC xic;
_AT_@ -667,6 +669,9 @@ xresize(int col, int row)
DefaultDepth(xw.dpy, xw.scr));
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h);
+
+ /* resize to new width */
+ xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec));
}
ushort
_AT_@ -1027,6 +1032,9 @@ xinit(void)
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
+ /* font spec buffer */
+ xw.specbuf = xmalloc(term.col * sizeof(GlyphFontSpec));
+
/* Xft rendering context */
xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
_AT_@ -1528,7 +1536,7 @@ drawregion(int x1, int y1, int x2, int y2)
term.dirty[y] = 0;
- specs = term.specbuf;
+ specs = xw.specbuf;
numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y);
i = ox = 0;
--
2.14.1
Received on Sun Sep 24 2017 - 23:11:37 CEST
This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:25:40 CEST