vte: remove kmscon_vte_bind()

Bind the console at vte creation instead of dynamically during runtime.
There is no need to rebind a console so remove this complexity.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-05-27 14:47:11 +02:00
parent a1b2202ccf
commit 2c5712685b
3 changed files with 6 additions and 16 deletions

View File

@ -284,10 +284,9 @@ int kmscon_terminal_new(struct kmscon_terminal **out,
if (ret)
goto err_free;
ret = kmscon_vte_new(&term->vte);
ret = kmscon_vte_new(&term->vte, term->console);
if (ret)
goto err_con;
kmscon_vte_bind(term->vte, term->console);
ret = kmscon_pty_new(&term->pty, term->eloop, pty_input, term);
if (ret)

View File

@ -115,12 +115,12 @@ struct kmscon_vte {
int csi_argv[CSI_ARG_MAX];
};
int kmscon_vte_new(struct kmscon_vte **out)
int kmscon_vte_new(struct kmscon_vte **out, struct kmscon_console *con)
{
struct kmscon_vte *vte;
int ret;
if (!out)
if (!out || !con)
return -EINVAL;
vte = malloc(sizeof(*vte));
@ -130,12 +130,14 @@ int kmscon_vte_new(struct kmscon_vte **out)
memset(vte, 0, sizeof(*vte));
vte->ref = 1;
vte->state = STATE_GROUND;
vte->con = con;
ret = kmscon_utf8_mach_new(&vte->mach);
if (ret)
goto err_free;
log_debug("new vte object");
kmscon_console_ref(vte->con);
*out = vte;
return 0;
@ -167,16 +169,6 @@ void kmscon_vte_unref(struct kmscon_vte *vte)
free(vte);
}
void kmscon_vte_bind(struct kmscon_vte *vte, struct kmscon_console *con)
{
if (!vte)
return;
kmscon_console_unref(vte->con);
vte->con = con;
kmscon_console_ref(vte->con);
}
/* execute control character (C0 or C1) */
static void do_execute(struct kmscon_vte *vte, uint32_t ctrl)
{

View File

@ -44,11 +44,10 @@ enum kmscon_vte_keyboard_action {
KMSCON_VTE_SEND,
};
int kmscon_vte_new(struct kmscon_vte **out);
int kmscon_vte_new(struct kmscon_vte **out, struct kmscon_console *con);
void kmscon_vte_ref(struct kmscon_vte *vte);
void kmscon_vte_unref(struct kmscon_vte *vte);
void kmscon_vte_bind(struct kmscon_vte *vte, struct kmscon_console *con);
void kmscon_vte_input(struct kmscon_vte *vte, const char *u8, size_t len);
int kmscon_vte_handle_keyboard(struct kmscon_vte *vte,
const struct uterm_input_event *ev, const char **u8, size_t *len);