st-relativeborder-20171207-0ac685f.diff - sites - public wiki contents of suckl… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
st-relativeborder-20171207-0ac685f.diff (1447B) | |
--- | |
1 diff --git a/config.def.h b/config.def.h | |
2 index 877afab..7adc94b 100644 | |
3 --- a/config.def.h | |
4 +++ b/config.def.h | |
5 @@ -4,9 +4,11 @@ | |
6 * appearance | |
7 * | |
8 * font: see http://freedesktop.org/software/fontconfig/fontconfig-user… | |
9 + * borderperc: percentage of cell width to use as a border | |
10 + * 0 = no border, 100 = border width is same as cell wid… | |
11 */ | |
12 char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=tru… | |
13 -int borderpx = 2; | |
14 +int borderperc = 20; | |
15 | |
16 /* | |
17 * What program is execed by st depends of these precedence rules: | |
18 diff --git a/st.h b/st.h | |
19 index 44d4938..3c625e9 100644 | |
20 --- a/st.h | |
21 +++ b/st.h | |
22 @@ -231,6 +231,7 @@ extern char *opt_line; | |
23 extern char *opt_name; | |
24 extern char *opt_title; | |
25 extern int oldbutton; | |
26 +int borderpx; | |
27 | |
28 extern char *usedfont; | |
29 extern double usedfontsize; | |
30 @@ -238,7 +239,7 @@ extern double defaultfontsize; | |
31 | |
32 /* config.h globals */ | |
33 extern char font[]; | |
34 -extern int borderpx; | |
35 +extern int borderperc; | |
36 extern float cwscale; | |
37 extern float chscale; | |
38 extern unsigned int doubleclicktimeout; | |
39 diff --git a/x.c b/x.c | |
40 index 191e5dc..f500dd4 100644 | |
41 --- a/x.c | |
42 +++ b/x.c | |
43 @@ -827,6 +827,8 @@ xloadfonts(char *fontstr, double fontsize) | |
44 win.cw = ceilf(dc.font.width * cwscale); | |
45 win.ch = ceilf(dc.font.height * chscale); | |
46 | |
47 + borderpx = ceilf(((float)borderperc / 100) * win.cw); | |
48 + | |
49 FcPatternDel(pattern, FC_SLANT); | |
50 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); | |
51 if (xloadfont(&dc.ifont, pattern)) |