=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.91 retrieving revision 1.92 diff -c -r1.91 -r1.92 *** src/usr.bin/tmux/server-client.c 2013/03/24 09:18:16 1.91 --- src/usr.bin/tmux/server-client.c 2013/03/24 09:25:04 1.92 *************** *** 1,4 **** ! /* $OpenBSD: server-client.c,v 1.91 2013/03/24 09:18:16 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-client.c,v 1.92 2013/03/24 09:25:04 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 17,22 **** --- 17,23 ---- */ #include + #include #include #include *************** *** 29,34 **** --- 30,36 ---- #include "tmux.h" void server_client_check_focus(struct window_pane *); + void server_client_check_resize(struct window_pane *); void server_client_check_mouse(struct client *, struct window_pane *); void server_client_repeat_timer(int, short, void *); void server_client_check_exit(struct client *); *************** *** 496,502 **** /* * Any windows will have been redrawn as part of clients, so clear ! * their flags now. Also check and update pane focus. */ for (i = 0; i < ARRAY_LENGTH(&windows); i++) { w = ARRAY_ITEM(&windows, i); --- 498,504 ---- /* * Any windows will have been redrawn as part of clients, so clear ! * their flags now. Also check pane focus and resize. */ for (i = 0; i < ARRAY_LENGTH(&windows); i++) { w = ARRAY_ITEM(&windows, i); *************** *** 506,514 **** --- 508,546 ---- w->flags &= ~WINDOW_REDRAW; TAILQ_FOREACH(wp, &w->panes, entry) { server_client_check_focus(wp); + server_client_check_resize(wp); wp->flags &= ~PANE_REDRAW; } } + } + + /* Check if pane should be resized. */ + void + server_client_check_resize(struct window_pane *wp) + { + struct winsize ws; + + if (wp->fd == -1 || !(wp->flags & PANE_RESIZE)) + return; + + memset(&ws, 0, sizeof ws); + ws.ws_col = wp->sx; + ws.ws_row = wp->sy; + + if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) { + #ifdef __sun + /* + * Some versions of Solaris apparently can return an error when + * resizing; don't know why this happens, can't reproduce on + * other platforms and ignoring it doesn't seem to cause any + * issues. + */ + if (errno != EINVAL) + #endif + fatal("ioctl failed"); + } + + wp->flags &= ~PANE_RESIZE; } /* Check whether pane should be focused. */