50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
guint term_paste_idle_id;
GdkAtom compound_text_atom;
int alt_keycode;
char wintitle[sizeof(((Config *)0)->wintitle)];
char icontitle[sizeof(((Config *)0)->wintitle)];
int master_fd, master_func_id, exited;
void *ldisc;
};
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(void *frontend, int echo, int edit)
|
>
>
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
guint term_paste_idle_id;
GdkAtom compound_text_atom;
int alt_keycode;
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(void *frontend, int echo, int edit)
|
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
|
if (inst->master_fd >= 0) {
pty_close();
inst->master_fd = -1;
gtk_input_remove(inst->master_func_id);
}
if (!inst->exited && back->exitcode(backhandle) >= 0) {
int exitcode = back->exitcode(backhandle);
int clean;
clean = WIFEXITED(exitcode) && (WEXITSTATUS(exitcode) == 0);
/*
* Terminate now, if the Close On Exit setting is
* appropriate.
|
|
|
|
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
|
if (inst->master_fd >= 0) {
pty_close();
inst->master_fd = -1;
gtk_input_remove(inst->master_func_id);
}
if (!inst->exited && inst->back->exitcode(inst->backhandle) >= 0) {
int exitcode = inst->back->exitcode(inst->backhandle);
int clean;
clean = WIFEXITED(exitcode) && (WEXITSTATUS(exitcode) == 0);
/*
* Terminate now, if the Close On Exit setting is
* appropriate.
|
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
|
exit(0);
}
gint timer_func(gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
if (back->exitcode(backhandle) >= 0) {
/*
* The primary child process died. We could keep the
* terminal open for remaining subprocesses to output to,
* but conventional wisdom seems to feel that that's the
* Wrong Thing for an xterm-alike, so we bail out now
* (though we don't necessarily _close_ the window,
* depending on the state of Close On Exit). This would be
|
|
|
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
|
exit(0);
}
gint timer_func(gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
if (inst->back->exitcode(inst->backhandle) >= 0) {
/*
* The primary child process died. We could keep the
* terminal open for remaining subprocesses to output to,
* but conventional wisdom seems to feel that that's the
* Wrong Thing for an xterm-alike, so we bail out now
* (though we don't necessarily _close_ the window,
* depending on the state of Close On Exit). This would be
|
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
|
inst->blankcursor = make_mouse_ptr(-1);
make_mouse_ptr(-2); /* clean up cursor font */
inst->currcursor = inst->textcursor;
show_mouseptr(1);
term = term_init();
back = &pty_backend;
back->init((void *)term, &backhandle, NULL, 0, NULL, 0);
term_provide_resize_fn(term, back->size, backhandle);
term_size(term, cfg.height, cfg.width, cfg.savelines);
inst->ldisc = ldisc_create(term, back, backhandle, inst);
ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
inst->master_fd = pty_master_fd;
inst->exited = FALSE;
inst->master_func_id = gdk_input_add(pty_master_fd, GDK_INPUT_READ,
pty_input_func, inst);
gtk_main();
return 0;
}
|
|
|
|
|
|
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
|
inst->blankcursor = make_mouse_ptr(-1);
make_mouse_ptr(-2); /* clean up cursor font */
inst->currcursor = inst->textcursor;
show_mouseptr(1);
term = term_init();
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);
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;
inst->master_func_id = gdk_input_add(pty_master_fd, GDK_INPUT_READ,
pty_input_func, inst);
gtk_main();
return 0;
}
|