version 1.19, 2009/09/23 06:05:02 |
version 1.20, 2009/09/23 06:12:58 |
|
|
#include "tmux.h" |
#include "tmux.h" |
|
|
void client_send_environ(struct client_ctx *); |
void client_send_environ(struct client_ctx *); |
void client_handle_winch(struct client_ctx *); |
|
|
|
int |
int |
client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) |
client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) |
|
|
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) |
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) |
fatal("ioctl(TIOCGWINSZ)"); |
fatal("ioctl(TIOCGWINSZ)"); |
data.flags = flags; |
data.flags = flags; |
data.sx = ws.ws_col; |
|
data.sy = ws.ws_row; |
|
|
|
if (getcwd(data.cwd, sizeof data.cwd) == NULL) |
if (getcwd(data.cwd, sizeof data.cwd) == NULL) |
*data.cwd = '\0'; |
*data.cwd = '\0'; |
|
|
waitpid(WAIT_ANY, NULL, WNOHANG); |
waitpid(WAIT_ANY, NULL, WNOHANG); |
sigchld = 0; |
sigchld = 0; |
} |
} |
if (sigwinch) |
if (sigwinch) { |
client_handle_winch(cctx); |
client_write_server(cctx, MSG_RESIZE, NULL, 0); |
|
sigwinch = 0; |
|
} |
if (sigcont) { |
if (sigcont) { |
siginit(); |
siginit(); |
client_write_server(cctx, MSG_WAKEUP, NULL, 0); |
client_write_server(cctx, MSG_WAKEUP, NULL, 0); |
|
|
printf("[unknown error]\n"); |
printf("[unknown error]\n"); |
return (1); |
return (1); |
} |
} |
} |
|
|
|
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 |
int |