예제 #1
0
void
tty_write(void (*cmdfn)(
    struct tty *, const struct tty_ctx *), const struct tty_ctx *ctx)
{
	struct window_pane	*wp = ctx->wp;
	struct client		*c;
	u_int		 	 i;

	/* wp can be NULL if updating the screen but not the terminal. */
	if (wp == NULL)
		return;

	if (wp->window->flags & WINDOW_REDRAW || wp->flags & PANE_REDRAW)
		return;
	if (!window_pane_visible(wp))
		return;

	for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
		c = ARRAY_ITEM(&clients, i);
		if (c == NULL || c->session == NULL)
			continue;
		if (c->flags & CLIENT_SUSPENDED)
			continue;

		if (c->session->curw->window == wp->window) {
			if (c->tty.term == NULL)
				continue;
			if (c->tty.flags & (TTY_FREEZE|TTY_BACKOFF))
				continue;
			cmdfn(&c->tty, ctx);
		}
	}
}
예제 #2
0
파일: tty.c 프로젝트: UNGLinux/Obase
void
tty_write(
    void (*cmdfn)(struct tty *, const struct tty_ctx *), struct tty_ctx *ctx)
{
	struct window_pane	*wp = ctx->wp;
	struct client		*c;
	struct session		*s;
	struct options		*oo;
	u_int		 	 i;

	/* wp can be NULL if updating the screen but not the terminal. */
	if (wp == NULL)
		return;

	if (wp->window->flags & WINDOW_REDRAW || wp->flags & PANE_REDRAW)
		return;
	if (!window_pane_visible(wp) || wp->flags & PANE_DROP)
		return;

	for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
		c = ARRAY_ITEM(&clients, i);
		if (c == NULL || c->session == NULL)
			continue;
		if (c->flags & CLIENT_SUSPENDED)
			continue;
		s = c->session;

		if (s->curw->window == wp->window) {
			if (c->tty.term == NULL)
				continue;
			if (c->tty.flags & TTY_FREEZE)
				continue;
			oo = &s->options;

			ctx->xoff = wp->xoff;
			ctx->yoff = wp->yoff;
			if (status_at_line(c) == 0)
				ctx->yoff++;

			cmdfn(&c->tty, ctx);
		}
	}
}