aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2017-10-10 11:30:36 -0500
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:53:24 -0600
commitd5275012b45149a2a6e94679609aacca478221ad (patch)
tree881a9c32d0d617fc472e23836779a7379c97e875
parent3518dba2a5fb57f601b74528ddeb67f173e4024b (diff)
downloadst-patched-d5275012b45149a2a6e94679609aacca478221ad.tar.bz2
st-patched-d5275012b45149a2a6e94679609aacca478221ad.tar.xz
st-patched-d5275012b45149a2a6e94679609aacca478221ad.zip
Move zoom functions into x.c
This makes x(un)loadfonts internal to x.c. Needed to reorder includes and move a typedef to keep the compiler happy. Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
-rw-r--r--st.c36
-rw-r--r--st.h1
-rw-r--r--win.h7
-rw-r--r--x.c35
4 files changed, 39 insertions, 40 deletions
diff --git a/st.c b/st.c
index 6338510..f1f7bc1 100644
--- a/st.c
+++ b/st.c
@@ -31,8 +31,8 @@
31#define Glyph Glyph_ 31#define Glyph Glyph_
32#define Font Font_ 32#define Font Font_
33 33
34#include "win.h"
35#include "st.h" 34#include "st.h"
35#include "win.h"
36 36
37#if defined(__linux) 37#if defined(__linux)
38 #include <pty.h> 38 #include <pty.h>
@@ -128,9 +128,6 @@ static void clipcopy(const Arg *);
128static void clippaste(const Arg *); 128static void clippaste(const Arg *);
129static void numlock(const Arg *); 129static void numlock(const Arg *);
130static void selpaste(const Arg *); 130static void selpaste(const Arg *);
131static void zoom(const Arg *);
132static void zoomabs(const Arg *);
133static void zoomreset(const Arg *);
134static void printsel(const Arg *); 131static void printsel(const Arg *);
135static void printscreen(const Arg *) ; 132static void printscreen(const Arg *) ;
136static void iso14755(const Arg *); 133static void iso14755(const Arg *);
@@ -2574,37 +2571,6 @@ tresize(int col, int row)
2574} 2571}
2575 2572
2576void 2573void
2577zoom(const Arg *arg)
2578{
2579 Arg larg;
2580
2581 larg.f = usedfontsize + arg->f;
2582 zoomabs(&larg);
2583}
2584
2585void
2586zoomabs(const Arg *arg)
2587{
2588 xunloadfonts();
2589 xloadfonts(usedfont, arg->f);
2590 cresize(0, 0);
2591 ttyresize();
2592 redraw();
2593 xhints();
2594}
2595
2596void
2597zoomreset(const Arg *arg)
2598{
2599 Arg larg;
2600
2601 if (defaultfontsize > 0) {
2602 larg.f = defaultfontsize;
2603 zoomabs(&larg);
2604 }
2605}
2606
2607void
2608resettitle(void) 2574resettitle(void)
2609{ 2575{
2610 xsettitle(opt_title ? opt_title : "st"); 2576 xsettitle(opt_title ? opt_title : "st");
diff --git a/st.h b/st.h
index 28a751d..9ece72f 100644
--- a/st.h
+++ b/st.h
@@ -100,6 +100,7 @@ typedef struct {
100} Glyph; 100} Glyph;
101 101
102typedef Glyph *Line; 102typedef Glyph *Line;
103typedef XftGlyphFontSpec GlyphFontSpec;
103 104
104typedef struct { 105typedef struct {
105 Glyph attr; /* current char attributes */ 106 Glyph attr; /* current char attributes */
diff --git a/win.h b/win.h
index 60cecb1..ea45e60 100644
--- a/win.h
+++ b/win.h
@@ -5,8 +5,6 @@
5#define XK_NO_MOD 0 5#define XK_NO_MOD 0
6#define XK_SWITCH_MOD (1<<13) 6#define XK_SWITCH_MOD (1<<13)
7 7
8typedef XftGlyphFontSpec GlyphFontSpec;
9
10void draw(void); 8void draw(void);
11void drawregion(int, int, int, int); 9void drawregion(int, int, int, int);
12 10
@@ -16,11 +14,12 @@ void xclippaste(void);
16void xhints(void); 14void xhints(void);
17void xloadcols(void); 15void xloadcols(void);
18int xsetcolorname(int, const char *); 16int xsetcolorname(int, const char *);
19void xloadfonts(char *, double);
20void xsettitle(char *); 17void xsettitle(char *);
21void xsetpointermotion(int); 18void xsetpointermotion(int);
22void xseturgency(int); 19void xseturgency(int);
23void xunloadfonts(void);
24void xresize(int, int); 20void xresize(int, int);
25void xselpaste(void); 21void xselpaste(void);
26void xsetsel(char *, Time); 22void xsetsel(char *, Time);
23void zoom(const Arg *);
24void zoomabs(const Arg *);
25void zoomreset(const Arg *);
diff --git a/x.c b/x.c
index f660ca3..426ca28 100644
--- a/x.c
+++ b/x.c
@@ -21,8 +21,8 @@ static char *argv0;
21#define Glyph Glyph_ 21#define Glyph Glyph_
22#define Font Font_ 22#define Font Font_
23 23
24#include "win.h"
25#include "st.h" 24#include "st.h"
25#include "win.h"
26 26
27/* XEMBED messages */ 27/* XEMBED messages */
28#define XEMBED_FOCUS_IN 4 28#define XEMBED_FOCUS_IN 4
@@ -90,7 +90,9 @@ static void xdrawcursor(void);
90static int xgeommasktogravity(int); 90static int xgeommasktogravity(int);
91static void xinit(void); 91static void xinit(void);
92static int xloadfont(Font *, FcPattern *); 92static int xloadfont(Font *, FcPattern *);
93static void xloadfonts(char *, double);
93static void xunloadfont(Font *); 94static void xunloadfont(Font *);
95static void xunloadfonts(void);
94static void xsetenv(void); 96static void xsetenv(void);
95 97
96static void expose(XEvent *); 98static void expose(XEvent *);
@@ -165,6 +167,37 @@ static Fontcache frc[16];
165static int frclen = 0; 167static int frclen = 0;
166 168
167void 169void
170zoom(const Arg *arg)
171{
172 Arg larg;
173
174 larg.f = usedfontsize + arg->f;
175 zoomabs(&larg);
176}
177
178void
179zoomabs(const Arg *arg)
180{
181 xunloadfonts();
182 xloadfonts(usedfont, arg->f);
183 cresize(0, 0);
184 ttyresize();
185 redraw();
186 xhints();
187}
188
189void
190zoomreset(const Arg *arg)
191{
192 Arg larg;
193
194 if (defaultfontsize > 0) {
195 larg.f = defaultfontsize;
196 zoomabs(&larg);
197 }
198}
199
200void
168getbuttoninfo(XEvent *e) 201getbuttoninfo(XEvent *e)
169{ 202{
170 int type; 203 int type;