From 962fa20b36cc6d38d9a44612441f3f706c29b71e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 23 Sep 2009 06:12:58 +0000 Subject: Trim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the client into the server. This is another (the second of four) protocol version changes coming this morning, so again the server should be killed before upgrading. --- client.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index ee3bba50..7ef61106 100644 --- a/client.c +++ b/client.c @@ -34,7 +34,6 @@ #include "tmux.h" void client_send_environ(struct client_ctx *); -void client_handle_winch(struct client_ctx *); int client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) @@ -100,8 +99,6 @@ server_started: if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) fatal("ioctl(TIOCGWINSZ)"); data.flags = flags; - data.sx = ws.ws_col; - data.sy = ws.ws_row; if (getcwd(data.cwd, sizeof data.cwd) == NULL) *data.cwd = '\0'; @@ -169,8 +166,10 @@ client_main(struct client_ctx *cctx) waitpid(WAIT_ANY, NULL, WNOHANG); sigchld = 0; } - if (sigwinch) - client_handle_winch(cctx); + if (sigwinch) { + client_write_server(cctx, MSG_RESIZE, NULL, 0); + sigwinch = 0; + } if (sigcont) { siginit(); client_write_server(cctx, MSG_WAKEUP, NULL, 0); @@ -238,22 +237,6 @@ out: } } -void -client_handle_winch(struct client_ctx *cctx) -{ - struct msg_resize_data data; - struct winsize ws; - - if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) - fatal("ioctl failed"); - - data.sx = ws.ws_col; - data.sy = ws.ws_row; - client_write_server(cctx, MSG_RESIZE, &data, sizeof data); - - sigwinch = 0; -} - int client_msg_dispatch(struct client_ctx *cctx) { -- cgit v1.2.3