aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAlexander Sedov <alex0player@gmail.com>2013-06-23 21:05:29 +0400
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2013-07-04 09:36:22 +0200
commitfbc589d50603e8b0de9239e4800e227ab5d0ea69 (patch)
treec5db62e806732165360467b4f5d7c07dbeec94bd /st.c
parent6fc471ccc660b305cf836dcb8d57cdbffb4ed017 (diff)
downloadst-fbc589d50603e8b0de9239e4800e227ab5d0ea69.tar.gz
st-fbc589d50603e8b0de9239e4800e227ab5d0ea69.zip
Remove long text being cropped/wrapped to standard 80x24 on launch.
To be more specific, now tty creation is delayed until X window is actually mapped; last ConfigureNotify before mapping determines initial tty size. Please report problems if there are any.
Diffstat (limited to 'st.c')
-rw-r--r--st.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/st.c b/st.c
index ac1954e..0fc724b 100644
--- a/st.c
+++ b/st.c
@@ -3520,10 +3520,28 @@ resize(XEvent *e) {
3520void 3520void
3521run(void) { 3521run(void) {
3522 XEvent ev; 3522 XEvent ev;
3523 int w = xw.w, h = xw.h;
3523 fd_set rfd; 3524 fd_set rfd;
3524 int xfd = XConnectionNumber(xw.dpy), xev, blinkset = 0, dodraw = 0; 3525 int xfd = XConnectionNumber(xw.dpy), xev, blinkset = 0, dodraw = 0;
3525 struct timeval drawtimeout, *tv = NULL, now, last, lastblink; 3526 struct timeval drawtimeout, *tv = NULL, now, last, lastblink;
3526 3527
3528 /* Waiting for window mapping */
3529 while(1) {
3530 XNextEvent(xw.dpy, &ev);
3531 if(ev.type == ConfigureNotify) {
3532 w = ev.xconfigure.width;
3533 h = ev.xconfigure.height;
3534 } else if(ev.type == MapNotify) {
3535 break;
3536 }
3537 }
3538
3539 if(!xw.isfixed)
3540 cresize(w, h);
3541 else
3542 cresize(xw.fw, xw.fh);
3543 ttynew();
3544
3527 gettimeofday(&lastblink, NULL); 3545 gettimeofday(&lastblink, NULL);
3528 gettimeofday(&last, NULL); 3546 gettimeofday(&last, NULL);
3529 3547
@@ -3673,10 +3691,7 @@ run:
3673 XSetLocaleModifiers(""); 3691 XSetLocaleModifiers("");
3674 tnew(80, 24); 3692 tnew(80, 24);
3675 xinit(); 3693 xinit();
3676 ttynew();
3677 selinit(); 3694 selinit();
3678 if(xw.isfixed)
3679 cresize(xw.h, xw.w);
3680 run(); 3695 run();
3681 3696
3682 return 0; 3697 return 0;