diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2017-10-10 11:30:36 -0500 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2018-02-25 21:53:24 -0600 |
commit | d5275012b45149a2a6e94679609aacca478221ad (patch) | |
tree | 881a9c32d0d617fc472e23836779a7379c97e875 | |
parent | 3518dba2a5fb57f601b74528ddeb67f173e4024b (diff) | |
download | st-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.c | 36 | ||||
-rw-r--r-- | st.h | 1 | ||||
-rw-r--r-- | win.h | 7 | ||||
-rw-r--r-- | x.c | 35 |
4 files changed, 39 insertions, 40 deletions
@@ -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 *); | |||
128 | static void clippaste(const Arg *); | 128 | static void clippaste(const Arg *); |
129 | static void numlock(const Arg *); | 129 | static void numlock(const Arg *); |
130 | static void selpaste(const Arg *); | 130 | static void selpaste(const Arg *); |
131 | static void zoom(const Arg *); | ||
132 | static void zoomabs(const Arg *); | ||
133 | static void zoomreset(const Arg *); | ||
134 | static void printsel(const Arg *); | 131 | static void printsel(const Arg *); |
135 | static void printscreen(const Arg *) ; | 132 | static void printscreen(const Arg *) ; |
136 | static void iso14755(const Arg *); | 133 | static void iso14755(const Arg *); |
@@ -2574,37 +2571,6 @@ tresize(int col, int row) | |||
2574 | } | 2571 | } |
2575 | 2572 | ||
2576 | void | 2573 | void |
2577 | zoom(const Arg *arg) | ||
2578 | { | ||
2579 | Arg larg; | ||
2580 | |||
2581 | larg.f = usedfontsize + arg->f; | ||
2582 | zoomabs(&larg); | ||
2583 | } | ||
2584 | |||
2585 | void | ||
2586 | zoomabs(const Arg *arg) | ||
2587 | { | ||
2588 | xunloadfonts(); | ||
2589 | xloadfonts(usedfont, arg->f); | ||
2590 | cresize(0, 0); | ||
2591 | ttyresize(); | ||
2592 | redraw(); | ||
2593 | xhints(); | ||
2594 | } | ||
2595 | |||
2596 | void | ||
2597 | zoomreset(const Arg *arg) | ||
2598 | { | ||
2599 | Arg larg; | ||
2600 | |||
2601 | if (defaultfontsize > 0) { | ||
2602 | larg.f = defaultfontsize; | ||
2603 | zoomabs(&larg); | ||
2604 | } | ||
2605 | } | ||
2606 | |||
2607 | void | ||
2608 | resettitle(void) | 2574 | resettitle(void) |
2609 | { | 2575 | { |
2610 | xsettitle(opt_title ? opt_title : "st"); | 2576 | xsettitle(opt_title ? opt_title : "st"); |
@@ -100,6 +100,7 @@ typedef struct { | |||
100 | } Glyph; | 100 | } Glyph; |
101 | 101 | ||
102 | typedef Glyph *Line; | 102 | typedef Glyph *Line; |
103 | typedef XftGlyphFontSpec GlyphFontSpec; | ||
103 | 104 | ||
104 | typedef struct { | 105 | typedef struct { |
105 | Glyph attr; /* current char attributes */ | 106 | Glyph attr; /* current char attributes */ |
@@ -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 | ||
8 | typedef XftGlyphFontSpec GlyphFontSpec; | ||
9 | |||
10 | void draw(void); | 8 | void draw(void); |
11 | void drawregion(int, int, int, int); | 9 | void drawregion(int, int, int, int); |
12 | 10 | ||
@@ -16,11 +14,12 @@ void xclippaste(void); | |||
16 | void xhints(void); | 14 | void xhints(void); |
17 | void xloadcols(void); | 15 | void xloadcols(void); |
18 | int xsetcolorname(int, const char *); | 16 | int xsetcolorname(int, const char *); |
19 | void xloadfonts(char *, double); | ||
20 | void xsettitle(char *); | 17 | void xsettitle(char *); |
21 | void xsetpointermotion(int); | 18 | void xsetpointermotion(int); |
22 | void xseturgency(int); | 19 | void xseturgency(int); |
23 | void xunloadfonts(void); | ||
24 | void xresize(int, int); | 20 | void xresize(int, int); |
25 | void xselpaste(void); | 21 | void xselpaste(void); |
26 | void xsetsel(char *, Time); | 22 | void xsetsel(char *, Time); |
23 | void zoom(const Arg *); | ||
24 | void zoomabs(const Arg *); | ||
25 | void zoomreset(const Arg *); | ||
@@ -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); | |||
90 | static int xgeommasktogravity(int); | 90 | static int xgeommasktogravity(int); |
91 | static void xinit(void); | 91 | static void xinit(void); |
92 | static int xloadfont(Font *, FcPattern *); | 92 | static int xloadfont(Font *, FcPattern *); |
93 | static void xloadfonts(char *, double); | ||
93 | static void xunloadfont(Font *); | 94 | static void xunloadfont(Font *); |
95 | static void xunloadfonts(void); | ||
94 | static void xsetenv(void); | 96 | static void xsetenv(void); |
95 | 97 | ||
96 | static void expose(XEvent *); | 98 | static void expose(XEvent *); |
@@ -165,6 +167,37 @@ static Fontcache frc[16]; | |||
165 | static int frclen = 0; | 167 | static int frclen = 0; |
166 | 168 | ||
167 | void | 169 | void |
170 | zoom(const Arg *arg) | ||
171 | { | ||
172 | Arg larg; | ||
173 | |||
174 | larg.f = usedfontsize + arg->f; | ||
175 | zoomabs(&larg); | ||
176 | } | ||
177 | |||
178 | void | ||
179 | zoomabs(const Arg *arg) | ||
180 | { | ||
181 | xunloadfonts(); | ||
182 | xloadfonts(usedfont, arg->f); | ||
183 | cresize(0, 0); | ||
184 | ttyresize(); | ||
185 | redraw(); | ||
186 | xhints(); | ||
187 | } | ||
188 | |||
189 | void | ||
190 | zoomreset(const Arg *arg) | ||
191 | { | ||
192 | Arg larg; | ||
193 | |||
194 | if (defaultfontsize > 0) { | ||
195 | larg.f = defaultfontsize; | ||
196 | zoomabs(&larg); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | void | ||
168 | getbuttoninfo(XEvent *e) | 201 | getbuttoninfo(XEvent *e) |
169 | { | 202 | { |
170 | int type; | 203 | int type; |