From 9305f3c184a0179e37802e752c3d1dc830ae893c Mon Sep 17 00:00:00 2001 From: noname Date: Wed, 8 Apr 2015 23:16:57 +0000 Subject: Remove variable names from function declarations. --- st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index 6d20977..6522c9d 100644 --- a/st.c +++ b/st.c @@ -359,7 +359,7 @@ static void csidump(void); static void csihandle(void); static void csiparse(void); static void csireset(void); -static int eschandle(uchar ascii); +static int eschandle(uchar); static void strdump(void); static void strhandle(void); static void strparse(void); @@ -406,7 +406,7 @@ static void ttyread(void); static void ttyresize(void); static void ttysend(char *, size_t); static void ttywrite(const char *, size_t); -static void tstrsequence(uchar c); +static void tstrsequence(uchar); static void xdraws(char *, Glyph, int, int, int, int); static void xhints(void); -- cgit v1.2.3-13-gbd6f From 6524f022f7d1d32f43208254e12f934bf64ed559 Mon Sep 17 00:00:00 2001 From: noname Date: Wed, 8 Apr 2015 23:17:33 +0000 Subject: Remove keywords from function definitions. --- st.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index 6522c9d..7dbd87a 100644 --- a/st.c +++ b/st.c @@ -408,6 +408,7 @@ static void ttysend(char *, size_t); static void ttywrite(const char *, size_t); static void tstrsequence(uchar); +static inline ushort sixd_to_16bit(int); static void xdraws(char *, Glyph, int, int, int, int); static void xhints(void); static void xclear(int, int, int, int); @@ -452,6 +453,8 @@ static char *getsel(void); static void selcopy(void); static void selscroll(int, int); static void selsnap(int, int *, int *, int); +static int x2col(int); +static int y2row(int); static void getbuttoninfo(XEvent *); static void mousereport(XEvent *); @@ -640,7 +643,7 @@ utf8validate(long *u, size_t i) { return i; } -static void +void selinit(void) { memset(&sel.tclick1, 0, sizeof(sel.tclick1)); memset(&sel.tclick2, 0, sizeof(sel.tclick2)); @@ -653,7 +656,7 @@ selinit(void) { sel.xtarget = XA_STRING; } -static int +int x2col(int x) { x -= borderpx; x /= xw.cw; @@ -661,7 +664,7 @@ x2col(int x) { return LIMIT(x, 0, term.col-1); } -static int +int y2row(int y) { y -= borderpx; y /= xw.ch; @@ -669,7 +672,7 @@ y2row(int y) { return LIMIT(y, 0, term.row-1); } -static int tlinelen(int y) { +int tlinelen(int y) { int i = term.col; if(term.line[y][i - 1].mode & ATTR_WRAP) @@ -681,7 +684,7 @@ static int tlinelen(int y) { return i; } -static void +void selnormalize(void) { int i; @@ -708,7 +711,7 @@ selnormalize(void) { sel.ne.x = term.col - 1; } -static inline bool +bool selected(int x, int y) { if(sel.type == SEL_RECTANGULAR) return BETWEEN(y, sel.nb.y, sel.ne.y) @@ -2857,7 +2860,7 @@ xresize(int col, int row) { xclear(0, 0, xw.w, xw.h); } -static inline ushort +ushort sixd_to_16bit(int x) { return x == 0 ? 0 : 0x3737 + 0x2828 * x; } @@ -3772,7 +3775,7 @@ focus(XEvent *ev) { } } -static inline bool +bool match(uint mask, uint state) { return mask == XK_ANY_MOD || mask == (state & ~ignoremod); } -- cgit v1.2.3-13-gbd6f From 6f5f7701864e6987544cb7e7dc5f2d24db1a4537 Mon Sep 17 00:00:00 2001 From: noname Date: Wed, 8 Apr 2015 23:24:06 +0000 Subject: Remove 'xloadfontset' function. It was used only once and its return value was ignored. --- st.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index 7dbd87a..0065240 100644 --- a/st.c +++ b/st.c @@ -419,7 +419,6 @@ static int xsetcolorname(int, const char *); static int xgeommasktogravity(int); static int xloadfont(Font *, FcPattern *); static void xloadfonts(char *, double); -static int xloadfontset(Font *); static void xsettitle(char *); static void xresettitle(void); static void xsetpointermotion(int); @@ -3116,15 +3115,6 @@ xloadfonts(char *fontstr, double fontsize) { FcPatternDestroy(pattern); } -int -xloadfontset(Font *f) { - FcResult result; - - if(!(f->set = FcFontSort(0, f->pattern, FcTrue, 0, &result))) - return 1; - return 0; -} - void xunloadfont(Font *f) { XftFontClose(xw.dpy, f->match); @@ -3472,7 +3462,8 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { /* Nothing was found. */ if(i >= frclen) { if(!font->set) - xloadfontset(font); + font->set = FcFontSort(0, font->pattern, + FcTrue, 0, &fcres); fcsets[0] = font->set; /* -- cgit v1.2.3-13-gbd6f From 93b54cfcc437c9bac9af3ceb2d9ba19c442de1ff Mon Sep 17 00:00:00 2001 From: noname Date: Thu, 9 Apr 2015 20:04:43 +0000 Subject: Use MAX macro where possible. --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'st.c') diff --git a/st.c b/st.c index 0065240..a7064b1 100644 --- a/st.c +++ b/st.c @@ -4072,7 +4072,7 @@ main(int argc, char *argv[]) { run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); - tnew(cols? cols : 1, rows? rows : 1); + tnew(MAX(cols, 1), MAX(rows, 1)); xinit(); selinit(); run(); -- cgit v1.2.3-13-gbd6f From ecac5ee35ef006001b280461ed3f9812d855250c Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Thu, 9 Apr 2015 18:22:31 -0700 Subject: Make DECSCUSR thickness configurable --- st.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index a7064b1..b2bcfe9 100644 --- a/st.c +++ b/st.c @@ -3591,15 +3591,15 @@ xdrawcursor(void) { case 4: /* Steady Underline */ XftDrawRect(xw.draw, &dc.col[defaultcs], borderpx + curx * xw.cw, - borderpx + (term.c.y + 1) * xw.ch - 1, - xw.cw, 1); + borderpx + (term.c.y + 1) * xw.ch - cursorthickness, + xw.cw, cursorthickness); break; case 5: /* Blinking bar */ case 6: /* Steady bar */ XftDrawRect(xw.draw, &dc.col[defaultcs], - borderpx + curx * xw.cw, - borderpx + term.c.y * xw.ch, - 1, xw.ch); + borderpx + curx * xw.cw, + borderpx + term.c.y * xw.ch, + cursorthickness, xw.ch); break; } } else { -- cgit v1.2.3-13-gbd6f