summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-08 23:02:56 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-08 23:02:56 +0000
commit2df08827223872cd6b3ac1df527e55c2275a08cc (patch)
treefb8469066812b92a57e837a1c9b8e338a8968071 /input.c
parent70b2f1981e76794f0de84427df733fc2e5eb5242 (diff)
Sync OpenBSD patchset 498:
Convert the window pane (pty master side) fd over to use a bufferevent. The evbuffer API is very similar to the existing tmux buffer API so this was remarkably painless. Not many possible ways to do it, I suppose.
Diffstat (limited to 'input.c')
-rw-r--r--input.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/input.c b/input.c
index 8ef6ef89..49f153d2 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* $Id: input.c,v 1.101 2009-10-28 23:12:38 tcunha Exp $ */
+/* $Id: input.c,v 1.102 2009-11-08 23:02:56 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -256,12 +256,12 @@ input_parse(struct window_pane *wp)
struct input_ctx *ictx = &wp->ictx;
u_char ch;
- if (BUFFER_USED(wp->in) == ictx->was)
+ if (EVBUFFER_LENGTH(wp->event->input) == ictx->was)
return;
wp->window->flags |= WINDOW_ACTIVITY;
- ictx->buf = BUFFER_OUT(wp->in);
- ictx->len = BUFFER_USED(wp->in);
+ ictx->buf = EVBUFFER_DATA(wp->event->input);
+ ictx->len = EVBUFFER_LENGTH(wp->event->input);
ictx->off = 0;
ictx->wp = wp;
@@ -278,8 +278,8 @@ input_parse(struct window_pane *wp)
screen_write_stop(&ictx->ctx);
- buffer_remove(wp->in, ictx->len);
- ictx->was = BUFFER_USED(wp->in);
+ evbuffer_drain(wp->event->input, ictx->len);
+ ictx->was = EVBUFFER_LENGTH(wp->event->input);
}
void
@@ -932,7 +932,8 @@ input_handle_sequence_cbt(struct input_ctx *ictx)
void
input_handle_sequence_da(struct input_ctx *ictx)
{
- uint16_t n;
+ struct window_pane *wp = ictx->wp;
+ uint16_t n;
if (ictx->private != '\0')
return;
@@ -944,7 +945,7 @@ input_handle_sequence_da(struct input_ctx *ictx)
if (n != 0)
return;
- buffer_write(ictx->wp->out, "\033[?1;2c", (sizeof "\033[?1;2c") - 1);
+ bufferevent_write(wp->event, "\033[?1;2c", (sizeof "\033[?1;2c") - 1);
}
void
@@ -1314,9 +1315,10 @@ input_handle_sequence_rm(struct input_ctx *ictx)
void
input_handle_sequence_dsr(struct input_ctx *ictx)
{
- struct screen *s = ictx->ctx.s;
- uint16_t n;
- char reply[32];
+ struct window_pane *wp = ictx->wp;
+ struct screen *s = ictx->ctx.s;
+ uint16_t n;
+ char reply[32];
if (ARRAY_LENGTH(&ictx->args) > 1)
return;
@@ -1329,7 +1331,7 @@ input_handle_sequence_dsr(struct input_ctx *ictx)
xsnprintf(reply, sizeof reply,
"\033[%u;%uR", s->cy + 1, s->cx + 1);
log_debug("cursor request, reply: %s", reply);
- buffer_write(ictx->wp->out, reply, strlen(reply));
+ bufferevent_write(wp->event, reply, strlen(reply));
break;
}
}