commit e3da1c6ae7d0df0c0162266088d181f0c17336c2
Author: Doug Whiteley <doug.whiteley_AT_cloudreach.com>
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
_AT_@ -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 - <dougwhiteley_AT_gmail.com>
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
_AT_@ -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
+_AT_@ -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
+_AT_@ -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;
+_AT_@ -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
+_AT_@ -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))
Received on Thu Dec 07 2017 - 11:58:01 CET