/*
* $Log$
+ * Revision 1.52 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
+ * Revision 1.51 2008/02/28 16:37:16 james
+ * *** empty log message ***
+ *
+ * Revision 1.50 2008/02/28 12:12:25 james
+ * *** empty log message ***
+ *
+ * Revision 1.49 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.48 2008/02/27 09:42:53 james
* *** empty log message ***
*
return 1;
}
+void
+vt102_crt_update (Context * c)
+{
+ VT102 *v = c->v;
+
+ v->crt.pos = v->pos;
+ v->crt.hide_cursor =
+ v->private_modes[VT102_PRIVATE_MODE_SHOW_CURSOR] ? 0 : 1;
+
+ if (v->current_line.y != v->pos.y)
+ {
+ vt102_log_line (c, v->current_line.y);
+ v->current_line = v->pos;
+ }
+
+ if (c->d)
+ cmd_show_status (c->d, c);
+}
+
+void
+vt102_do_resize (Context * c)
+{
+
+ VT102 *v = c->v;
+
+ v->crt.size = v->current_size;
+ v->crt.size.y++;
+ v->screen_end = v->current_size;
+ v->screen_end.x--;
+ v->screen_end.y--;
+ v->top_margin = v->screen_start;
+ v->bottom_margin = v->screen_end;
+ vt102_cursor_home (v);
+ crt_cls (&v->crt);
+
+ if (c->t)
+ tty_winch (c->t, v->current_size);
+
+ log_f (c->l, "<size now %dx%d>", v->current_size.x, v->current_size.y);
+ vt102_crt_update (c);
+}
+
+
void
vt102_log_line (Context * c, int line)
{
void
-vt102_change_mode (VT102 * v, int private, char *ns, int set)
+vt102_change_mode (Context * c, int private, char *ns, int set)
{
+ VT102 *v = c->v;
int m;
private_modes[VT102_PRIVATE_MODE_132COLS] ? VT102_COLS_132 :
VT102_COLS_80;
- v->crt.size = v->current_size;
- v->crt.size.y++;
- v->screen_end = v->current_size;
- v->screen_end.x--;
- v->screen_end.y--;
- v->top_margin = v->screen_start;
- v->bottom_margin = v->screen_end;
- vt102_cursor_home (v);
- crt_cls (&v->crt);
-
-
+ vt102_do_resize (c);
break;
}
}
void
-vt102_parse_mode_string (VT102 * v, char *buf, int len)
+vt102_parse_mode_string (Context * c, char *buf, int len)
{
+ VT102 *v = c->v;
int private = 0;
char last = buf[len - 1];
char num[4];
{
if (*buf == ';')
{
- vt102_change_mode (v, private, &num[o], last == 'h');
+ vt102_change_mode (c, private, &num[o], last == 'h');
memset (num, 0, sizeof (num));
o = sizeof (num) - 1;
buf++;
buf++;
}
- vt102_change_mode (v, private, &num[o], last == 'h');
+ vt102_change_mode (c, private, &num[o], last == 'h');
}
break;
case 'h':
case 'l':
- vt102_parse_mode_string (v, &buf[1], len - 1);
+ vt102_parse_mode_string (c, &buf[1], len - 1);
break;
vt102_send_id (c, terminal_id);
break;
case 'c':
- vt102_reset (v);
-
-
+ vt102_reset (c);
break;
case '=':
v->application_keypad_mode = 1;
void
-vt102_reset_state (VT102 * v)
+vt102_reset_state (Context * c)
{
+ VT102 *v = c->v;
vt102_parser_reset (&v->parser);
v->attr = CRT_ATTR_NORMAL;
v->application_keypad_mode = 0;
v->current_size = v->original_size;
- v->crt.size = v->current_size;
- v->crt.size.y++;
- v->screen_end = v->current_size;
- v->screen_end.x--;
- v->screen_end.y--;
- v->top_margin = v->screen_start;
- v->bottom_margin = v->screen_end;
+ vt102_do_resize (c);
memset (v->modes, 0, VT102_NMODES);
memset (v->private_modes, 0, VT102_NMODES);
#endif
if (ch == SYM_CHAR_RESET)
{
- vt102_reset_state (v);
+ vt102_reset_state (c);
}
else if (p->in_cmd && !ctrl_chr (ch, p->cmd_termination))
{
#endif
}
- v->crt.pos = v->pos;
- v->crt.hide_cursor =
- v->private_modes[VT102_PRIVATE_MODE_SHOW_CURSOR] ? 0 : 1;
+ vt102_crt_update (c);
- if (v->current_line.y != v->pos.y)
- {
- vt102_log_line (c, v->current_line.y);
- v->current_line = v->pos;
- }
- if (c->d)
- cmd_show_status (c->d, c);
}
void
}
void
-vt102_reset (VT102 * v)
+vt102_reset (Context * c)
{
+ VT102 *v = c->v;
VT102_parser *p = &v->parser;
v->current_line = v->pos;
vt102_parser_reset (p);
- vt102_reset_state (v);
+ vt102_reset_state (c);
vt102_save_state (v);
if (v->original_size.x > VT102_MAX_COLS)
v->original_size.x = VT102_MAX_COLS;
- if (v->original_size.y > VT102_ROWS)
- v->original_size.y = VT102_ROWS;
+ if (v->original_size.y > VT102_MAX_ROWS)
+ v->original_size.y = VT102_MAX_ROWS;
}
else
{
v->original_size.x = VT102_COLS_80;
- v->original_size.y = VT102_ROWS;
+ v->original_size.y = VT102_ROWS_24;
}
- vt102_reset (v);
-
return v;
}
v->xn_glitch = ansi ? 0 : 1;
}
+void
+vt102_resize (Context * c, CRT_Pos size)
+{
+ log_f (c->l, "<size change to %dx%d requested>", size.x, size.y);
+
+ if (!size.x)
+ size.x = c->v->current_size.x;
+ if (!size.y)
+ size.y = c->v->current_size.y;
+
+ if (size.x < 1)
+ size.x = 1;
+ if (size.y < 1)
+ size.y = 1;
+
+ if (size.x > VT102_MAX_COLS)
+ size.x = VT102_MAX_COLS;
+ if (size.y > VT102_MAX_ROWS)
+ size.y = VT102_MAX_ROWS;
+
+ c->v->current_size = size;
+ vt102_do_resize (c);
+}
+
void
vt102_free (VT102 * v)
{