Hi,
The patches work fine. The issue is fixed with it. Thanks for the patch.
On Wed, Jun 02, 2010 at 11:01:30PM +0100, Nicholas Marriott wrote:
>Please try this which should fix it (includes the part I already sent to
>you so start from a clean tree).
>
>I'm not sure sending a resize message after the client attaches is the
>best solution, and I can't actually hit the race there, although I'm
>pretty certain it exists. Can't see anywhere else to put it though, the
>server is entirely dependent on the client for SIGWINCH and there will
>always be a potential gap between tty_start_tty() in the server and the
>client changing the SIGWINCH handler.
>
>
>Index: client.c
>===================================================================
>RCS file: /cvs/src/usr.bin/tmux/client.c,v
>retrieving revision 1.39
>diff -u -p -r1.39 client.c
>--- client.c 12 May 2010 15:05:39 -0000 1.39
>+++ client.c 2 Jun 2010 21:58:43 -0000
>@@ -180,6 +180,13 @@ client_main(void)
> set_signals(client_signal);
>
> /*
>+ * Send a resize message immediately in case the terminal size has
>+ * changed between the identify message to the server and the MSG_READY
>+ * telling us to move into the client code.
>+ */
>+ client_write_server(MSG_RESIZE, NULL, 0);
>+
>+ /*
> * imsg_read in the first client poll loop (before the terminal has
> * been initialised) may have read messages into the buffer after the
> * MSG_READY switched to here. Process anything outstanding now to
>Index: server-client.c
>===================================================================
>RCS file: /cvs/src/usr.bin/tmux/server-client.c,v
>retrieving revision 1.31
>diff -u -p -r1.31 server-client.c
>--- server-client.c 23 May 2010 19:42:19 -0000 1.31
>+++ server-client.c 2 Jun 2010 21:58:44 -0000
>@@ -561,9 +561,10 @@ server_client_msg_dispatch(struct client
> if (datalen != 0)
> fatalx("bad MSG_RESIZE size");
>
>- tty_resize(&c->tty);
>- recalculate_sizes();
>- server_redraw_client(c);
>+ if (tty_resize(&c->tty)) {
>+ recalculate_sizes();
>+ server_redraw_client(c);
>+ }
> break;
> case MSG_EXITING:
> if (datalen != 0)
>Index: tmux.h
>===================================================================
>RCS file: /cvs/src/usr.bin/tmux/tmux.h,v
>retrieving revision 1.223
>diff -u -p -r1.223 tmux.h
>--- tmux.h 31 May 2010 19:51:29 -0000 1.223
>+++ tmux.h 2 Jun 2010 21:58:45 -0000
>@@ -1351,7 +1351,7 @@ void tty_puts(struct tty *, const char *
> void tty_putc(struct tty *, u_char);
> void tty_pututf8(struct tty *, const struct grid_utf8 *);
> void tty_init(struct tty *, int, char *);
>-void tty_resize(struct tty *);
>+int tty_resize(struct tty *);
> void tty_start_tty(struct tty *);
> void tty_stop_tty(struct tty *);
> void tty_set_title(struct tty *, const char *);
>Index: tty.c
>===================================================================
>RCS file: /cvs/src/usr.bin/tmux/tty.c,v
>retrieving revision 1.86
>diff -u -p -r1.86 tty.c
>--- tty.c 31 May 2010 19:51:29 -0000 1.86
>+++ tty.c 2 Jun 2010 21:58:45 -0000
>@@ -73,34 +73,55 @@ tty_init(struct tty *tty, int fd, char *
> tty->term_flags = 0;
> }
>
>-void
>+int
> tty_resize(struct tty *tty)
> {
> struct winsize ws;
>+ u_int sx, sy;
>
> if (ioctl(tty->fd, TIOCGWINSZ, &ws) != -1) {
>- tty->sx = ws.ws_col;
>- tty->sy = ws.ws_row;
>+ sx = ws.ws_col;
>+ if (sx == 0)
>+ sx = 80;
>+ sy = ws.ws_row;
>+ if (sy == 0)
>+ sy = 24;
>+ } else {
>+ sx = 80;
>+ sy = 24;
> }
>- if (tty->sx == 0)
>- tty->sx = 80;
>- if (tty->sy == 0)
>- tty->sy = 24;
>+ if (sx == tty->sx && sy == tty->sy)
>+ return (0);
>+ tty->sx = sx;
>+ tty->sy = sy;
>
> tty->cx = UINT_MAX;
> tty->cy = UINT_MAX;
>
> tty->rupper = UINT_MAX;
> tty->rlower = UINT_MAX;
>+
>+ /*
>+ * If the terminal has been started, reset the actual scroll region and
>+ * cursor position, as this may not have happened.
>+ */
>+ if (tty->flags & TTY_STARTED) {
>+ tty_cursor(tty, 0, 0);
>+ tty_region(tty, 0, tty->sy - 1);
>+ }
>+
>+ return (1);
> }
>
> int
> tty_open(struct tty *tty, const char *overrides, char **cause)
> {
>+ char out[MAXPATHLEN];
> int fd;
>
> if (debug_level > 3) {
>- fd = open("tmux.out", O_WRONLY|O_CREAT|O_TRUNC, 0644);
>+ xsnprintf(out, sizeof out, "tmux-out-%ld.log", (long) getpid());
>+ fd = open(out, O_WRONLY|O_CREAT|O_TRUNC, 0644);
> if (fd != -1 && fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
> fatal("fcntl failed");
> tty->log_fd = fd;
>
>
>
>
>
>On Thu, Jun 03, 2010 at 02:29:22AM +0530, Raghavendra D Prabhu wrote:
>> Hi,
>> I faced a issue of tmux not recognising the window dimensions correctly in
>> xterm.
>> Nicholas suggested in #tmux to add
>>
>> client_write_server(MSG_RESIZE, NULL, 0);
>>
>> in client.c(CVS head) .. That seemed to have solved the dimensions
>> problem. But the window still does not get redrawn. Only doing
>> prefix-r or running any
>> other command like ls overwrites it.
>>
>> I have tested this with xmonad and dwm. In both this issue persists. I am
>> attaching tmux info for reference.
>>
>>
>> -------------------
>> Raghavendra D Prabhu
>
>> tmux 1.3, pid 19021, started Thu Jun 3 01:56:05 2010
>> socket path /tmp//tmux-1000/default, debug level 0
>> system is Linux 2.6.34-rc6-zen1-EIL #7 ZEN SMP PREEMPT Fri May 14 20:04:42
>> IST 2010 x86_64
>> configuration file is /home/raghavendra/.tmux.conf
>> protocol version is 5
>> 3 clients, 2 sessions
>>
>> Clients:
>> 0: /dev/pts/0 (9, 10): term [141x43 xterm-color] [flags=0x1/0x38,
>> references=0]
>> 1: /dev/pts/2 (12, 13): uake [125x21 xterm-color] [flags=0x1/0x38,
>> references=0]
>>
>> Sessions: [5/10]
>> 0: term: 2 windows (created Thu Jun 3 02:05:00 2010) [141x42] [flags=0x0,
>> references=0]
>> 1: bash [141x42] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/1 20527 11 36/42, 12020 bytes; UTF-8 0/42, 0 bytes
>> 2: mutt [141x42] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/9 21582 20 42/42, 16635 bytes; UTF-8 0/42, 0 bytes
>> 1: uake: 6 windows (created Thu Jun 3 01:56:05 2010) [125x20] [flags=0x0,
>> references=0]
>> 1: weechat-curses [125x20] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/3 19031 14 20/20, 10665 bytes; UTF-8 1/20, 550 bytes
>> 2: bash [125x20] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/4 19033 15 40/40, 13290 bytes; UTF-8 0/40, 0 bytes
>> 3: less [125x20] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/5 19036 16 192/199, 28850 bytes; UTF-8 0/199, 0 bytes
>> 4: bash [125x20] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/6 19041 17 1/20, 55 bytes; UTF-8 0/20, 0 bytes
>> 5: bash [125x20] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/7 19048 18 1/20, 55 bytes; UTF-8 0/20, 0 bytes
>> 6: bash [125x20] [flags=0x0, references=1, last layout=-1]
>> 0: /dev/pts/8 19054 19 36/54, 12230 bytes; UTF-8 0/54, 0 bytes
>>
>> Terminals:
>> xterm-color [references=2, flags=0x0]:
>> 1: acsc: (string) ``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~
>> 0: AX: [missing]
>> 2: bel: (string) \007
>> 3: blink: [missing]
>> 4: bold: (string) \033[1m
>> 5: civis: [missing]
>> 6: clear: (string) \033[H\033[2J
>> 7: cnorm: [missing]
>> 8: colors: (number) 8
>> 9: csr: (string) \033[%i%p1%d;%p2%dr
>> 10: cub: (string) \033[%p1%dD
>> 11: cub1: (string) \010
>> 12: cud: (string) \033[%p1%dB
>> 13: cud1: (string) \012
>> 14: cuf: (string) \033[%p1%dC
>> 15: cuf1: (string) \033[C
>> 16: cup: (string) \033[%i%p1%d;%p2%dH
>> 17: cuu: (string) \033[%p1%dA
>> 18: cuu1: (string) \033[A
>> 19: dch: (string) \033[%p1%dP
>> 20: dch1: (string) \033[P
>> 21: dim: [missing]
>> 22: dl: (string) \033[%p1%dM
>> 23: dl1: (string) \033[M
>> 24: el: (string) \033[K
>> 25: el1: [missing]
>> 26: enacs: (string) \033)0
>> 27: home: (string) \033[H
>> 28: hpa: [missing]
>> 29: ich: [missing]
>> 30: ich1: [missing]
>> 31: il: (string) \033[%p1%dL
>> 32: il1: (string) \033[L
>> 33: invis: [missing]
>> 34: is1: [missing]
>> 35: is2: (string) \033[m\033[?7h\033[4l\033>\0337\033[r\033[?1;3;4;6l\0338
>> 36: is3: [missing]
>> 37: kcbt: [missing]
>> 38: kcub1: (string) \033OD
>> 39: kcud1: (string) \033OB
>> 40: kcuf1: (string) \033OC
>> 41: kcuu1: (string) \033OA
>> 42: kDC: [missing]
>> 43: kDC3: [missing]
>> 44: kDC4: [missing]
>> 45: kDC5: [missing]
>> 46: kDC6: [missing]
>> 47: kDC7: [missing]
>> 48: kdch1: (string) \033[3~
>> 49: kDN: [missing]
>> 50: kDN3: [missing]
>> 51: kDN4: [missing]
>> 52: kDN5: [missing]
>> 53: kDN6: [missing]
>> 54: kDN7: [missing]
>> 55: kend: [missing]
>> 56: kEND: [missing]
>> 57: kEND3: [missing]
>> 58: kEND4: [missing]
>> 59: kEND5: [missing]
>> 60: kEND6: [missing]
>> 61: kEND7: [missing]
>> 62: kf1: (string) \033[11~
>> 63: kf10: (string) \033[21~
>> 64: kf11: (string) \033[23~
>> 65: kf12: (string) \033[24~
>> 66: kf13: (string) \033[25~
>> 67: kf14: (string) \033[26~
>> 68: kf15: (string) \033[28~
>> 69: kf16: (string) \033[29~
>> 70: kf17: (string) \033[31~
>> 71: kf18: (string) \033[32~
>> 72: kf19: (string) \033[33~
>> 73: kf2: (string) \033[12~
>> 74: kf20: (string) \033[34~
>> 75: kf3: (string) \033[13~
>> 76: kf4: (string) \033[14~
>> 77: kf5: (string) \033[15~
>> 78: kf6: (string) \033[17~
>> 79: kf7: (string) \033[18~
>> 80: kf8: (string) \033[19~
>> 81: kf9: (string) \033[20~
>> 82: kHOM: [missing]
>> 83: kHOM3: [missing]
>> 84: kHOM4: [missing]
>> 85: kHOM5: [missing]
>> 86: kHOM6: [missing]
>> 87: kHOM7: [missing]
>> 88: khome: [missing]
>> 89: kIC: [missing]
>> 90: kIC3: [missing]
>> 91: kIC4: [missing]
>> 92: kIC5: [missing]
>> 93: kIC6: [missing]
>> 94: kIC7: [missing]
>> 95: kich1: (string) \033[2~
>> 96: kLFT: [missing]
>> 97: kLFT3: [missing]
>> 98: kLFT4: [missing]
>> 99: kLFT5: [missing]
>> 100: kLFT6: [missing]
>> 101: kLFT7: [missing]
>> 102: kmous: (string) \033[M
>> 103: knp: (string) \033[6~
>> 104: kNXT: [missing]
>> 105: kNXT3: [missing]
>> 106: kNXT4: [missing]
>> 107: kNXT5: [missing]
>> 108: kNXT6: [missing]
>> 109: kNXT7: [missing]
>> 110: kpp: (string) \033[5~
>> 111: kPRV: [missing]
>> 112: kPRV3: [missing]
>> 113: kPRV4: [missing]
>> 114: kPRV5: [missing]
>> 115: kPRV6: [missing]
>> 116: kPRV7: [missing]
>> 117: kRIT: [missing]
>> 118: kRIT3: [missing]
>> 119: kRIT4: [missing]
>> 120: kRIT5: [missing]
>> 121: kRIT6: [missing]
>> 122: kRIT7: [missing]
>> 123: kUP: [missing]
>> 124: kUP3: [missing]
>> 125: kUP4: [missing]
>> 126: kUP5: [missing]
>> 127: kUP6: [missing]
>> 128: kUP7: [missing]
>> 129: op: (string) \033[m
>> 130: rev: (string) \033[7m
>> 131: ri: (string) \033M
>> 132: rmacs: (string) \017
>> 133: rmcup: (string) \033[2J\033[?47l\0338
>> 134: rmir: (string) \033[4l
>> 135: rmkx: (string) \033[?1l\033>
>> 136: setab: (string) \033[4%p1%dm
>> 137: setaf: (string) \033[3%p1%dm
>> 138: sgr0: (string) \033[m
>> 139: smacs: (string) \016
>> 140: smcup: (string) \0337\033[?47h
>> 141: smir: (string) \033[4h
>> 142: smkx: (string) \033[?1h\033=
>> 143: smso: (string) \033[7m
>> 144: smul: (string) \033[4m
>> 145: vpa: [missing]
>> 146: xenl: (flag) true
>>
>> Jobs:
>
>
>
-------------------
Raghavendra D Prabhu
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users