aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2018-02-21 22:28:41 -0600
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:53:24 -0600
commitd84f3f4bd15e7d65fc0334cf7d62913c901bad00 (patch)
tree8d7a06956aab3d332423b59257a67adf4b92906f
parent8b564c1a3f51c08e64c2f589852a02b8595d44ca (diff)
downloadst-patched-d84f3f4bd15e7d65fc0334cf7d62913c901bad00.tar.bz2
st-patched-d84f3f4bd15e7d65fc0334cf7d62913c901bad00.tar.xz
st-patched-d84f3f4bd15e7d65fc0334cf7d62913c901bad00.zip
Rely on ttyresize to set tty size
This removes ttynew's dependency on cresize being called first, and then allows us to absorb the ttyresize call into cresize (which always precedes it). Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
-rw-r--r--st.c3
-rw-r--r--x.c6
2 files changed, 3 insertions, 6 deletions
diff --git a/st.c b/st.c
index 9cfa547..dae7b91 100644
--- a/st.c
+++ b/st.c
@@ -670,7 +670,6 @@ void
670ttynew(char *line, char *out, char **args) 670ttynew(char *line, char *out, char **args)
671{ 671{
672 int m, s; 672 int m, s;
673 struct winsize w = {term.row, term.col, 0, 0};
674 673
675 if (out) { 674 if (out) {
676 term.mode |= MODE_PRINT; 675 term.mode |= MODE_PRINT;
@@ -691,7 +690,7 @@ ttynew(char *line, char *out, char **args)
691 } 690 }
692 691
693 /* seems to work fine on linux, openbsd and freebsd */ 692 /* seems to work fine on linux, openbsd and freebsd */
694 if (openpty(&m, &s, NULL, NULL, &w) < 0) 693 if (openpty(&m, &s, NULL, NULL, NULL) < 0)
695 die("openpty failed: %s\n", strerror(errno)); 694 die("openpty failed: %s\n", strerror(errno));
696 695
697 switch (pid = fork()) { 696 switch (pid = fork()) {
diff --git a/x.c b/x.c
index e5b236d..7bfa1b7 100644
--- a/x.c
+++ b/x.c
@@ -276,7 +276,6 @@ zoomabs(const Arg *arg)
276 xunloadfonts(); 276 xunloadfonts();
277 xloadfonts(usedfont, arg->f); 277 xloadfonts(usedfont, arg->f);
278 cresize(0, 0); 278 cresize(0, 0);
279 ttyresize(win.tw, win.th);
280 redraw(); 279 redraw();
281 xhints(); 280 xhints();
282} 281}
@@ -695,6 +694,7 @@ cresize(int width, int height)
695 694
696 tresize(col, row); 695 tresize(col, row);
697 xresize(col, row); 696 xresize(col, row);
697 ttyresize(win.tw, win.th);
698} 698}
699 699
700void 700void
@@ -1794,7 +1794,6 @@ resize(XEvent *e)
1794 return; 1794 return;
1795 1795
1796 cresize(e->xconfigure.width, e->xconfigure.height); 1796 cresize(e->xconfigure.width, e->xconfigure.height);
1797 ttyresize(win.tw, win.th);
1798} 1797}
1799 1798
1800void 1799void
@@ -1823,9 +1822,8 @@ run(void)
1823 } 1822 }
1824 } while (ev.type != MapNotify); 1823 } while (ev.type != MapNotify);
1825 1824
1826 cresize(w, h);
1827 ttynew(opt_line, opt_io, opt_cmd); 1825 ttynew(opt_line, opt_io, opt_cmd);
1828 ttyresize(win.tw, win.th); 1826 cresize(w, h);
1829 1827
1830 clock_gettime(CLOCK_MONOTONIC, &last); 1828 clock_gettime(CLOCK_MONOTONIC, &last);
1831 lastblink = last; 1829 lastblink = last;