char wintitle[sizeof(((Config *)0)->wintitle)];
char icontitle[sizeof(((Config *)0)->wintitle)];
int master_fd, master_func_id, exited;
+ void *ldisc;
+ Backend *back;
+ void *backhandle;
};
static struct gui_data the_inst;
static struct gui_data *inst = &the_inst; /* so we always write `inst->' */
static int send_raw_mouse;
-void ldisc_update(int echo, int edit)
+void ldisc_update(void *frontend, int echo, int edit)
{
/*
* This is a stub in pterm. If I ever produce a Unix
printf("\n");
#endif
- ldisc_send(output+start, end-start, 1);
+ ldisc_send(inst->ldisc, output+start, end-start, 1);
show_mouseptr(0);
term_seen_key_event(term);
term_out(term);
gtk_input_remove(inst->master_func_id);
}
- if (!inst->exited && back->exitcode(backhandle) >= 0) {
- int exitcode = back->exitcode(backhandle);
+ if (!inst->exited && inst->back->exitcode(inst->backhandle) >= 0) {
+ int exitcode = inst->back->exitcode(inst->backhandle);
int clean;
clean = WIFEXITED(exitcode) && (WEXITSTATUS(exitcode) == 0);
}
}
-void frontend_keypress(void)
+void frontend_keypress(void *handle)
{
+ struct gui_data *inst = (struct gui_data *)handle;
+
/*
* If our child process has exited but not closed, terminate on
* any keypress.
{
struct gui_data *inst = (struct gui_data *)data;
- if (back->exitcode(backhandle) >= 0) {
+ if (inst->back->exitcode(inst->backhandle) >= 0) {
/*
* The primary child process died. We could keep the
* terminal open for remaining subprocesses to output to,
term = term_init();
- back = &pty_backend;
- back->init((void *)term, &backhandle, NULL, 0, NULL, 0);
+ inst->back = &pty_backend;
+ inst->back->init((void *)term, &inst->backhandle, NULL, 0, NULL, 0);
+
+ term_provide_resize_fn(term, inst->back->size, inst->backhandle);
term_size(term, cfg.height, cfg.width, cfg.savelines);
- ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
+
+ inst->ldisc = ldisc_create(term, inst->back, inst->backhandle, inst);
+ ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
inst->master_fd = pty_master_fd;
inst->exited = FALSE;