[hackers] [st][PATCH 03/23] Move zoom functions into x.c

From: Devin J. Pohly <djpohly_AT_gmail.com>
Date: Sun, 24 Sep 2017 16:11:25 -0500

xhints is now internal to x.c
---
 st.c  | 36 +-----------------------------------
 st.h  |  2 ++
 win.h |  6 +++---
 x.c   | 34 +++++++++++++++++++++++++++++++++-
 4 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/st.c b/st.c
index 7ae864e..825197c 100644
--- a/st.c
+++ b/st.c
_AT_@ -31,8 +31,8 @@
 #define Glyph Glyph_
 #define Font Font_
 
-#include "win.h"
 #include "st.h"
+#include "win.h"
 
 #if   defined(__linux)
  #include <pty.h>
_AT_@ -128,9 +128,6 @@ static void clipcopy(const Arg *);
 static void clippaste(const Arg *);
 static void numlock(const Arg *);
 static void selpaste(const Arg *);
-static void zoom(const Arg *);
-static void zoomabs(const Arg *);
-static void zoomreset(const Arg *);
 static void printsel(const Arg *);
 static void printscreen(const Arg *) ;
 static void iso14755(const Arg *);
_AT_@ -2574,37 +2571,6 @@ tresize(int col, int row)
 	term.c = c;
 }
 
-void
-zoom(const Arg *arg)
-{
-	Arg larg;
-
-	larg.f = usedfontsize + arg->f;
-	zoomabs(&larg);
-}
-
-void
-zoomabs(const Arg *arg)
-{
-	xunloadfonts();
-	xloadfonts(usedfont, arg->f);
-	cresize(0, 0);
-	ttyresize();
-	redraw();
-	xhints();
-}
-
-void
-zoomreset(const Arg *arg)
-{
-	Arg larg;
-
-	if (defaultfontsize > 0) {
-		larg.f = defaultfontsize;
-		zoomabs(&larg);
-	}
-}
-
 void
 resettitle(void)
 {
diff --git a/st.h b/st.h
index e4328fc..53d5009 100644
--- a/st.h
+++ b/st.h
_AT_@ -90,6 +90,8 @@ typedef unsigned int uint;
 typedef unsigned long ulong;
 typedef unsigned short ushort;
 
+typedef XftGlyphFontSpec GlyphFontSpec;
+
 typedef uint_least32_t Rune;
 
 typedef struct {
diff --git a/win.h b/win.h
index e6e4448..2454b50 100644
--- a/win.h
+++ b/win.h
_AT_@ -5,15 +5,12 @@
 #define XK_NO_MOD     0
 #define XK_SWITCH_MOD (1<<13)
 
-typedef XftGlyphFontSpec GlyphFontSpec;
-
 void draw(void);
 void drawregion(int, int, int, int);
 
 void xbell(void);
 void xclipcopy(void);
 void xclippaste(void);
-void xhints(void);
 void xloadcols(void);
 int xsetcolorname(int, const char *);
 void xloadfonts(char *, double);
_AT_@ -25,3 +22,6 @@ void xresize(int, int);
 void xselpaste(void);
 unsigned long xwinid(void);
 void xsetsel(char *, Time);
+void zoom(const Arg *);
+void zoomabs(const Arg *);
+void zoomreset(const Arg *);
diff --git a/x.c b/x.c
index b5cc58e..8aeb9c0 100644
--- a/x.c
+++ b/x.c
_AT_@ -21,8 +21,8 @@
 static char *argv0;
 
 #include "arg.h"
-#include "win.h"
 #include "st.h"
+#include "win.h"
 
 /* XEMBED messages */
 #define XEMBED_FOCUS_IN  4
_AT_@ -90,6 +90,7 @@ static void xdrawcursor(void);
 static int xgeommasktogravity(int);
 static int xloadfont(Font *, FcPattern *);
 static void xunloadfont(Font *);
+static void xhints(void);
 static void xinit(void);
 static void xseturgency(int);
 
_AT_@ -414,6 +415,37 @@ xselpaste(void)
 			xw.win, CurrentTime);
 }
 
+void
+zoom(const Arg *arg)
+{
+	Arg larg;
+
+	larg.f = usedfontsize + arg->f;
+	zoomabs(&larg);
+}
+
+void
+zoomabs(const Arg *arg)
+{
+	xunloadfonts();
+	xloadfonts(usedfont, arg->f);
+	cresize(0, 0);
+	ttyresize();
+	redraw();
+	xhints();
+}
+
+void
+zoomreset(const Arg *arg)
+{
+	Arg larg;
+
+	if (defaultfontsize > 0) {
+		larg.f = defaultfontsize;
+		zoomabs(&larg);
+	}
+}
+
 void
 xclipcopy(void)
 {
-- 
2.14.1
Received on Sun Sep 24 2017 - 23:11:25 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:24:36 CEST