aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c
index c644bb01..d8907f2a 100644
--- a/server-client.c
+++ b/server-client.c
@@ -23,8 +23,6 @@
#include <errno.h>
#include <event.h>
#include <fcntl.h>
-#include <imsg.h>
-#include <paths.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -1342,6 +1340,14 @@ server_client_resize_force(struct window_pane *wp)
wp->sy <= 1)
return (0);
+ memset(&ws, 0, sizeof ws);
+ ws.ws_col = wp->sx;
+ ws.ws_row = wp->sy - 1;
+ if (wp->fd != -1 && ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
+#ifdef __sun
+ if (errno != EINVAL && errno != ENXIO)
+#endif
+ fatal("ioctl failed");
log_debug("%s: %%%u forcing resize", __func__, wp->id);
window_pane_send_resize(wp, -1);
@@ -1354,6 +1360,22 @@ server_client_resize_force(struct window_pane *wp)
static void
server_client_resize_pane(struct window_pane *wp)
{
+ struct winsize ws;
+
+ memset(&ws, 0, sizeof ws);
+ ws.ws_col = wp->sx;
+ ws.ws_row = wp->sy;
+ if (wp->fd != -1 && 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 && errno != ENXIO)
+#endif
+ fatal("ioctl failed");
log_debug("%s: %%%u resize to %u,%u", __func__, wp->id, wp->sx, wp->sy);
window_pane_send_resize(wp, 0);
@@ -1963,6 +1985,10 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
c->name = name;
log_debug("client %p name is %s", c, c->name);
+#ifdef __CYGWIN__
+ c->fd = open(c->ttyname, O_RDWR|O_NOCTTY);
+#endif
+
if (c->flags & CLIENT_CONTROL) {
c->stdin_callback = control_callback;