aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjames <>2008-02-28 22:00:45 +0000
committerjames <>2008-02-28 22:00:45 +0000
commit3ea64d3f157cabbf22a9c96d5dd356659047a093 (patch)
tree79c5f3c8f6d4efe32abe9abf7c23b0f338487c03 /src
parent68f1170ace397c32f9c80a6b7cb89388d88743f2 (diff)
downloadsympathy-3ea64d3f157cabbf22a9c96d5dd356659047a093.tar.gz
sympathy-3ea64d3f157cabbf22a9c96d5dd356659047a093.tar.bz2
sympathy-3ea64d3f157cabbf22a9c96d5dd356659047a093.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/ansi.c33
-rw-r--r--src/cmd.c14
-rw-r--r--src/keydis.c5
-rw-r--r--src/prototypes.h6
4 files changed, 47 insertions, 11 deletions
diff --git a/src/ansi.c b/src/ansi.c
index 4113a36..970d353 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.36 2008/02/28 22:00:42 james
+ * *** empty log message ***
+ *
* Revision 1.35 2008/02/28 16:57:51 james
* *** empty log message ***
*
@@ -728,6 +731,26 @@ ansi_terminal_reset (ANSI * a)
ansi_move (a, p);
}
+
+int ansi_key(ANSI *a,Context *c,int key)
+{
+
+ if (!c->d)
+ return c->k->key (c->k, c, key);
+
+ cmd_show_status (c->d, c);
+
+ if (c->d->active)
+ return cmd_key (c->d, c,a, key);
+
+ if (key == CMD_KEY)
+ return cmd_activate (c->d, c);
+
+
+ return c->k->key (c->k, c, key);
+}
+
+
static void
ansi_flush_escape (ANSI * a, Context * c)
{
@@ -736,7 +759,7 @@ ansi_flush_escape (ANSI * a, Context * c)
for (i = 0; i < p->escape_ptr; ++i)
{
- keydis_key (c->k, c, p->escape_buf[i]);
+ ansi_key (a, c, p->escape_buf[i]);
}
p->escape_ptr = 0;
@@ -755,11 +778,11 @@ ansi_parse_deckey (ANSI * a, Context * c)
if ((p->escape_buf[2] >= 'A') || (p->escape_buf[2] <= 'Z'))
{
- keydis_key (c->k, c, KEY_UP + (p->escape_buf[2] - 'A'));
+ ansi_key (a, c, KEY_UP + (p->escape_buf[2] - 'A'));
}
else if ((p->escape_buf[2] >= 'a') || (p->escape_buf[2] <= 'z'))
{
- keydis_key (c->k, c, KEY_154 + (p->escape_buf[2] - 'a'));
+ ansi_key (a, c, KEY_154 + (p->escape_buf[2] - 'a'));
}
else
{
@@ -782,7 +805,7 @@ ansi_parse_ansikey (ANSI * a, Context * c)
}
if ((p->escape_buf[2] >= '0') || (p->escape_buf[2] <= '9'))
{
- keydis_key (c->k, c, KEY_180 + (p->escape_buf[2] - '0'));
+ ansi_key (a, c, KEY_180 + (p->escape_buf[2] - '0'));
}
else
{
@@ -895,7 +918,7 @@ ansi_parse_char (ANSI * a, Context * c, int ch)
}
else
{
- keydis_key (c->k, c, ch);
+ ansi_key (a, c, ch);
}
}
diff --git a/src/cmd.c b/src/cmd.c
index 7e86977..34dc2f4 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.7 2008/02/28 22:00:42 james
+ * *** empty log message ***
+ *
* Revision 1.6 2008/02/28 16:57:51 james
* *** empty log message ***
*
@@ -34,7 +37,7 @@ static char rcsid[] = "$Id$";
int
-cmd_parse (Cmd * c, Context * ctx, char *buf)
+cmd_parse (Cmd * c, Context * ctx,ANSI *a, char *buf)
{
if (!strcmp (buf, "quit"))
c->disconnect++;
@@ -54,6 +57,11 @@ cmd_parse (Cmd * c, Context * ctx, char *buf)
ctx->k->hangup (ctx->k, ctx);
else if (!strcmp (buf, "reset"))
ctx->k->reset (ctx->k, ctx);
+ else if (!strcmp (buf, "expand")) {
+ int w=a->terminal->size.x;
+ int h=a->terminal->size.y-1;
+ ctx->k->set_size (ctx->k, ctx, w,h);
+ }
else if (!strncmp (buf, "width", 5))
ctx->k->set_size (ctx->k, ctx, atoi (buf + 5), 0);
else if (!strncmp (buf, "height", 6))
@@ -82,7 +90,7 @@ cmd_show_status (Cmd * c, Context * ctx)
}
int
-cmd_key (Cmd * c, Context * ctx, int key)
+cmd_key (Cmd * c, Context * ctx,ANSI *a, int key)
{
if (c->error)
@@ -95,7 +103,7 @@ cmd_key (Cmd * c, Context * ctx, int key)
if (key == 13)
{
- if (cmd_parse (c, ctx, c->buf + 1))
+ if (cmd_parse (c, ctx, a,c->buf + 1))
{
c->error++;
}
diff --git a/src/keydis.c b/src/keydis.c
index c6e4db2..a288347 100644
--- a/src/keydis.c
+++ b/src/keydis.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/28 22:00:42 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/28 16:57:52 james
* *** empty log message ***
*
@@ -276,6 +279,7 @@ keydis_ipc_new (Socket * s)
+#if 0
int
keydis_key (KeyDis * t, Context * c, int key)
{
@@ -294,3 +298,4 @@ keydis_key (KeyDis * t, Context * c, int key)
return t->key (t, c, key);
}
+#endif
diff --git a/src/prototypes.h b/src/prototypes.h
index e96cb1b..c378764 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -1,4 +1,5 @@
/* ansi.c */
+extern int ansi_key(ANSI *a, Context *c, int key);
extern int ansi_dispatch(ANSI *a, Context *c);
extern ANSI *ansi_new_from_terminal(TTY *t, int utf8);
/* crt.c */
@@ -66,6 +67,7 @@ extern void tty_set_baud(TTY *t, int rate);
extern void tty_send_break(TTY *t);
extern void tty_set_flow(TTY *t, int flow);
extern void tty_hangup(TTY *t);
+extern void tty_length(TTY *t, int l);
extern void tty_winch(TTY *t, CRT_Pos size);
extern void tty_parse_reset(Context *c);
extern void tty_analyse(Context *c);
@@ -74,7 +76,6 @@ extern void tty_parse(Context *c, uint8_t *buf, int len);
/* keydis.c */
extern KeyDis *keydis_vt102_new(void);
extern KeyDis *keydis_ipc_new(Socket *s);
-extern int keydis_key(KeyDis *t, Context *c, int key);
/* history.c */
extern History *history_new(int n);
extern void history_free(History *h);
@@ -143,9 +144,8 @@ extern int socket_write(Socket *s, void *buf, int len);
/* serial.c */
extern TTY *serial_open(char *path, int lock_mode);
/* cmd.c */
-extern int cmd_parse(Cmd *c, Context *ctx, char *buf);
+extern int cmd_parse(Cmd *c, Context *ctx, ANSI *a, char *buf);
extern void cmd_show_status(Cmd *c, Context *ctx);
-extern int cmd_key(Cmd *c, Context *ctx, int key);
extern int cmd_activate(Cmd *c, Context *ctx);
extern void cmd_new_status(Cmd *c, Context *ctx, char *msg);
extern Cmd *cmd_new(void);