summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-09-28 22:47:22 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-09-28 22:47:22 +0000
commitaafee17de62d21f5cd5ced9a798a89c39bb8a70a (patch)
tree0f883f4683c033ae13e57ac8caf22d024b2d9c40 /window.c
parentd2e035f892ac8b21889e0124157a9be4f94462d3 (diff)
New input parser via state machine.
Diffstat (limited to 'window.c')
-rw-r--r--window.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/window.c b/window.c
index 37ae9593..ec22399b 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.11 2007-09-27 09:15:58 nicm Exp $ */
+/* $Id: window.c,v 1.12 2007-09-28 22:47:22 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -102,6 +102,7 @@ window_create(const char *cmd, const char **environ, u_int sx, u_int sy)
w->in = buffer_create(BUFSIZ);
w->out = buffer_create(BUFSIZ);
screen_create(&w->screen, sx, sy);
+ input_init(&w->ictx, &w->screen);
name = xstrdup(cmd);
if ((ptr = strchr(name, ' ')) != NULL) {
@@ -175,6 +176,8 @@ window_destroy(struct window *w)
{
close(w->fd);
+ input_free(&w->ictx);
+
buffer_destroy(w->in);
buffer_destroy(w->out);
xfree(w);
@@ -300,7 +303,7 @@ window_input(struct window *w, struct buffer *b, size_t size)
size -= 2;
key = (int16_t) input_extract16(b);
}
- input_key(w->out, key);
+ input_translate_key(w->out, key);
}
}
@@ -313,8 +316,7 @@ window_output(struct window *w, struct buffer *b)
{
size_t used;
- used = input_parse(
- BUFFER_OUT(w->in), BUFFER_USED(w->in), b, &w->screen);
+ used = input_parse(&w->ictx, BUFFER_OUT(w->in), BUFFER_USED(w->in), b);
if (used != 0)
buffer_remove(w->in, used);
}