diff options
-rw-r--r-- | config.def.h | 1 | ||||
-rw-r--r-- | st.c | 25 |
2 files changed, 25 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h index cc16f97..0a3c3e0 100644 --- a/config.def.h +++ b/config.def.h | |||
@@ -116,6 +116,7 @@ static Shortcut shortcuts[] = { | |||
116 | { XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, | 116 | { XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, |
117 | { MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} }, | 117 | { MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} }, |
118 | { MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} }, | 118 | { MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} }, |
119 | { MODKEY|ShiftMask, XK_Home, xzoomreset, {.i = 0} }, | ||
119 | { ShiftMask, XK_Insert, selpaste, {.i = 0} }, | 120 | { ShiftMask, XK_Insert, selpaste, {.i = 0} }, |
120 | { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} }, | 121 | { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} }, |
121 | { MODKEY, XK_Num_Lock, numlock, {.i = 0} }, | 122 | { MODKEY, XK_Num_Lock, numlock, {.i = 0} }, |
@@ -317,6 +317,8 @@ static void clippaste(const Arg *); | |||
317 | static void numlock(const Arg *); | 317 | static void numlock(const Arg *); |
318 | static void selpaste(const Arg *); | 318 | static void selpaste(const Arg *); |
319 | static void xzoom(const Arg *); | 319 | static void xzoom(const Arg *); |
320 | static void xzoomabs(const Arg *); | ||
321 | static void xzoomreset(const Arg *); | ||
320 | static void printsel(const Arg *); | 322 | static void printsel(const Arg *); |
321 | static void printscreen(const Arg *) ; | 323 | static void printscreen(const Arg *) ; |
322 | static void toggleprinter(const Arg *); | 324 | static void toggleprinter(const Arg *); |
@@ -503,6 +505,7 @@ static int oldbutton = 3; /* button event on startup: 3 = release */ | |||
503 | 505 | ||
504 | static char *usedfont = NULL; | 506 | static char *usedfont = NULL; |
505 | static double usedfontsize = 0; | 507 | static double usedfontsize = 0; |
508 | static double defaultfontsize = 0; | ||
506 | 509 | ||
507 | static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; | 510 | static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; |
508 | static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; | 511 | static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; |
@@ -2993,6 +2996,7 @@ xloadfonts(char *fontstr, double fontsize) { | |||
2993 | FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12); | 2996 | FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12); |
2994 | usedfontsize = 12; | 2997 | usedfontsize = 12; |
2995 | } | 2998 | } |
2999 | defaultfontsize = usedfontsize; | ||
2996 | } | 3000 | } |
2997 | 3001 | ||
2998 | FcConfigSubstitute(0, pattern, FcMatchPattern); | 3002 | FcConfigSubstitute(0, pattern, FcMatchPattern); |
@@ -3005,6 +3009,8 @@ xloadfonts(char *fontstr, double fontsize) { | |||
3005 | FcPatternGetDouble(dc.font.match->pattern, | 3009 | FcPatternGetDouble(dc.font.match->pattern, |
3006 | FC_PIXEL_SIZE, 0, &fontval); | 3010 | FC_PIXEL_SIZE, 0, &fontval); |
3007 | usedfontsize = fontval; | 3011 | usedfontsize = fontval; |
3012 | if(fontsize == 0) | ||
3013 | defaultfontsize = fontval; | ||
3008 | } | 3014 | } |
3009 | 3015 | ||
3010 | /* Setting character width and height. */ | 3016 | /* Setting character width and height. */ |
@@ -3058,16 +3064,33 @@ xunloadfonts(void) { | |||
3058 | xunloadfont(&dc.ibfont); | 3064 | xunloadfont(&dc.ibfont); |
3059 | } | 3065 | } |
3060 | 3066 | ||
3067 | |||
3061 | void | 3068 | void |
3062 | xzoom(const Arg *arg) { | 3069 | xzoom(const Arg *arg) { |
3070 | Arg larg; | ||
3071 | larg.i = usedfontsize + arg->i; | ||
3072 | xzoomabs(&larg); | ||
3073 | } | ||
3074 | |||
3075 | void | ||
3076 | xzoomabs(const Arg *arg) { | ||
3063 | xunloadfonts(); | 3077 | xunloadfonts(); |
3064 | xloadfonts(usedfont, usedfontsize + arg->i); | 3078 | xloadfonts(usedfont, arg->i); |
3065 | cresize(0, 0); | 3079 | cresize(0, 0); |
3066 | redraw(0); | 3080 | redraw(0); |
3067 | xhints(); | 3081 | xhints(); |
3068 | } | 3082 | } |
3069 | 3083 | ||
3070 | void | 3084 | void |
3085 | xzoomreset(const Arg *arg) { | ||
3086 | Arg larg; | ||
3087 | if(defaultfontsize > 0) { | ||
3088 | larg.i = defaultfontsize; | ||
3089 | xzoomabs(&larg); | ||
3090 | } | ||
3091 | } | ||
3092 | |||
3093 | void | ||
3071 | xinit(void) { | 3094 | xinit(void) { |
3072 | XGCValues gcvalues; | 3095 | XGCValues gcvalues; |
3073 | Cursor cursor; | 3096 | Cursor cursor; |