[hackers] [st] do not truncate font size when zooming || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 19 Jun 2015 11:50:26 +0200 (CEST)

commit bdd649a10289ade364f3deab3bbf6ee3169d67ca
Author: Quentin Rameau <quinq_AT_quinq.eu.org>
Date: Sun May 31 12:26:11 2015 +0200

    do not truncate font size when zooming

diff --git a/config.def.h b/config.def.h
index bb5596e..64e75b8 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -120,9 +120,9 @@ static Shortcut shortcuts[] = {
         { ControlMask, XK_Print, toggleprinter, {.i = 0} },
         { ShiftMask, XK_Print, printscreen, {.i = 0} },
         { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
- { MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} },
- { MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} },
- { MODKEY|ShiftMask, XK_Home, xzoomreset, {.i = 0} },
+ { MODKEY|ShiftMask, XK_Prior, xzoom, {.f = +1} },
+ { MODKEY|ShiftMask, XK_Next, xzoom, {.f = -1} },
+ { MODKEY|ShiftMask, XK_Home, xzoomreset, {.f = 0} },
         { ShiftMask, XK_Insert, selpaste, {.i = 0} },
         { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
         { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
diff --git a/st.c b/st.c
index 3dd5caf..bb64c55 100644
--- a/st.c
+++ b/st.c
_AT_@ -3061,7 +3061,6 @@ xloadfont(Font *f, FcPattern *pattern) {
 void
 xloadfonts(char *fontstr, double fontsize) {
         FcPattern *pattern;
- FcResult r_sz, r_psz;
         double fontval;
         float ceilf(float);
 
_AT_@ -3080,11 +3079,11 @@ xloadfonts(char *fontstr, double fontsize) {
                 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize);
                 usedfontsize = fontsize;
         } else {
- r_psz = FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval);
- r_sz = FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval);
- if(r_psz == FcResultMatch) {
+ if(FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
+ FcResultMatch) {
                         usedfontsize = fontval;
- } else if(r_sz == FcResultMatch) {
+ } else if(FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) ==
+ FcResultMatch) {
                         usedfontsize = -1;
                 } else {
                         /*
_AT_@ -3157,14 +3156,14 @@ void
 xzoom(const Arg *arg) {
         Arg larg;
 
- larg.i = usedfontsize + arg->i;
+ larg.f = usedfontsize + arg->f;
         xzoomabs(&larg);
 }
 
 void
 xzoomabs(const Arg *arg) {
         xunloadfonts();
- xloadfonts(usedfont, arg->i);
+ xloadfonts(usedfont, arg->f);
         cresize(0, 0);
         redraw();
         xhints();
_AT_@ -3175,7 +3174,7 @@ xzoomreset(const Arg *arg) {
         Arg larg;
 
         if(defaultfontsize > 0) {
- larg.i = defaultfontsize;
+ larg.f = defaultfontsize;
                 xzoomabs(&larg);
         }
 }
Received on Fri Jun 19 2015 - 11:50:26 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 19 2015 - 12:00:12 CEST