Merge branch 'obsd-master'

Conflicts:
	Makefile.am
	cfg.c
	server-client.c
This commit is contained in:
Thomas Adam
2017-05-31 15:56:13 +01:00
29 changed files with 2614 additions and 2008 deletions

View File

@ -1036,6 +1036,44 @@ server_client_loop(void)
}
}
/* Check if we need to force a resize. */
static int
server_client_resize_force(struct window_pane *wp)
{
struct timeval tv = { .tv_usec = 100000 };
struct winsize ws;
/*
* If we are resizing to the same size as when we entered the loop
* (that is, to the same size the application currently thinks it is),
* tmux may have gone through several resizes internally and thrown
* away parts of the screen. So we need the application to actually
* redraw even though its final size has not changed.
*/
if (wp->flags & PANE_RESIZEFORCE) {
wp->flags &= ~PANE_RESIZEFORCE;
return (0);
}
if (wp->sx != wp->osx ||
wp->sy != wp->osy ||
wp->sx <= 1 ||
wp->sy <= 1)
return (0);
memset(&ws, 0, sizeof ws);
ws.ws_col = wp->sx;
ws.ws_row = wp->sy - 1;
if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
fatal("ioctl failed");
log_debug("%s: %%%u forcing resize", __func__, wp->id);
evtimer_add(&wp->resize_timer, &tv);
wp->flags |= PANE_RESIZEFORCE;
return (1);
}
/* Resize timer event. */
static void
server_client_resize_event(__unused int fd, __unused short events, void *data)
@ -1047,12 +1085,12 @@ server_client_resize_event(__unused int fd, __unused short events, void *data)
if (!(wp->flags & PANE_RESIZE))
return;
if (server_client_resize_force(wp))
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
@ -1066,6 +1104,9 @@ server_client_resize_event(__unused int fd, __unused short events, void *data)
}
wp->flags &= ~PANE_RESIZE;
wp->osx = wp->sx;
wp->osy = wp->sy;
}
/* Check if pane should be resized. */
@ -1076,6 +1117,7 @@ server_client_check_resize(struct window_pane *wp)
if (!(wp->flags & PANE_RESIZE))
return;
log_debug("%s: %%%u resize to %u,%u", __func__, wp->id, wp->sx, wp->sy);
if (!event_initialized(&wp->resize_timer))
evtimer_set(&wp->resize_timer, server_client_resize_event, wp);
@ -1436,10 +1478,9 @@ server_client_dispatch(struct imsg *imsg, void *arg)
if (c->flags & CLIENT_CONTROL)
break;
if (tty_resize(&c->tty)) {
recalculate_sizes();
server_redraw_client(c);
}
tty_resize(&c->tty);
recalculate_sizes();
server_redraw_client(c);
if (c->session != NULL)
notify_client("client-resized", c);
break;