commit e3da1c6ae7d0df0c0162266088d181f0c17336c2
Author: Doug Whiteley <[email protected]>
Date:   Thu Dec 7 10:57:42 2017 +0000

    [st] Add relativeborder patch

diff --git a/st.suckless.org/patches/relativeborder/index.md 
b/st.suckless.org/patches/relativeborder/index.md
new file mode 100644
index 00000000..b34a123f
--- /dev/null
+++ b/st.suckless.org/patches/relativeborder/index.md
@@ -0,0 +1,19 @@
+# relativeborder
+
+## Description
+
+When working with a mixture of different DPI scales on different monitors, you
+need to use a flexible font that will size correctly no matter the DPI - for
+example, `DejaVu Sans Mono-10`. If you have a border set in pixels, this border
+will look vastly different in size depending on the DPI of your display.
+
+This patch allows you to specify a border that is relative in size to the width
+of a cell in the terminal.
+
+## Download
+
+ * 
[st-relativeborder-20171207-0ac685f.diff](st-relativeborder-20171207-0ac685f.diff)
+
+## Authors
+
+ * Doug Whiteley - <[email protected]>
diff --git 
a/st.suckless.org/patches/relativeborder/st-relativeborder-20171207.diff 
b/st.suckless.org/patches/relativeborder/st-relativeborder-20171207.diff
new file mode 100644
index 00000000..ac1b8a3d
--- /dev/null
+++ b/st.suckless.org/patches/relativeborder/st-relativeborder-20171207.diff
@@ -0,0 +1,51 @@
+diff --git a/config.def.h b/config.def.h
+index 877afab..7adc94b 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -4,9 +4,11 @@
+  * appearance
+  *
+  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
++ * borderperc: percentage of cell width to use as a border
++ *            0 = no border, 100 = border width is same as cell width
+  */
+ char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+-int borderpx = 2;
++int borderperc = 20;
+ 
+ /*
+  * What program is execed by st depends of these precedence rules:
+diff --git a/st.h b/st.h
+index 44d4938..3c625e9 100644
+--- a/st.h
++++ b/st.h
+@@ -231,6 +231,7 @@ extern char *opt_line;
+ extern char *opt_name;
+ extern char *opt_title;
+ extern int oldbutton;
++int borderpx;
+ 
+ extern char *usedfont;
+ extern double usedfontsize;
+@@ -238,7 +239,7 @@ extern double defaultfontsize;
+ 
+ /* config.h globals */
+ extern char font[];
+-extern int borderpx;
++extern int borderperc;
+ extern float cwscale;
+ extern float chscale;
+ extern unsigned int doubleclicktimeout;
+diff --git a/x.c b/x.c
+index 191e5dc..f500dd4 100644
+--- a/x.c
++++ b/x.c
+@@ -827,6 +827,8 @@ xloadfonts(char *fontstr, double fontsize)
+       win.cw = ceilf(dc.font.width * cwscale);
+       win.ch = ceilf(dc.font.height * chscale);
+ 
++      borderpx = ceilf(((float)borderperc / 100) * win.cw);
++
+       FcPatternDel(pattern, FC_SLANT);
+       FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+       if (xloadfont(&dc.ifont, pattern))


Reply via email to