sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e3da1c6ae7d0df0c0162266088d181f0c17336c2
parent 381c2c157726f17137f0c065485d99e2a2a60ab2
Author: Doug Whiteley <doug.whiteley@cloudreach.com>
Date:   Thu,  7 Dec 2017 10:57:42 +0000

[st] Add relativeborder patch

Diffstat:
Ast.suckless.org/patches/relativeborder/index.md | 19+++++++++++++++++++
Ast.suckless.org/patches/relativeborder/st-relativeborder-20171207.diff | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/st.suckless.org/patches/relativeborder/index.md 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 - <dougwhiteley@gmail.com> diff --git a/st.suckless.org/patches/relativeborder/st-relativeborder-20171207.diff 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))