X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkwin.c;h=f3a17d58434c2fdb1453fac5ea2ce95e794ce227;hb=d23c0972cd850c77871f9a314e0520d7023c8b62;hp=4f626cbe1ace982cd4612c8d87f9d1a1c112cec8;hpb=e4c4bd20920e11458ab0ec0cd17c69b8bf7f6d00;p=PuTTY.git diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 4f626cbe..f3a17d58 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -194,7 +194,7 @@ int platform_default_i(const char *name, int def) } /* Dummy routine, only required in plink. */ -void ldisc_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(void *frontend, int echo, int edit) { } @@ -1477,14 +1477,20 @@ static gint timer_trigger(gpointer data) long ticks; /* - * The timer we last scheduled via gtk_timeout_add has just - * triggered, and since we're about to return FALSE, it won't be - * resumed. So zero out its id, in case we don't overwrite it in - * the next loop. + * Destroy the timer we got here on. */ - timer_id = 0; + if (timer_id) { + gtk_timeout_remove(timer_id); + timer_id = 0; + } - if (run_timers(now, &next)) { + /* + * run_timers() may cause a call to timer_change_notify, in which + * case a new timer will already have been set up and left in + * timer_id. If it hasn't, and run_timers reports that some timing + * still needs to be done, we do it ourselves. + */ + if (run_timers(now, &next) && !timer_id) { then = now; now = GETTICKCOUNT(); if (now - then > next - then) @@ -1496,8 +1502,9 @@ static gint timer_trigger(gpointer data) } /* - * Never let a timer resume. If we need another one, we've - * asked for it explicitly above. + * Returning FALSE means 'don't call this timer again', which + * _should_ be redundant given that we removed it above, but just + * in case, return FALSE anyway. */ return FALSE; } @@ -3013,7 +3020,7 @@ void reset_terminal_menuitem(GtkMenuItem *item, gpointer data) struct gui_data *inst = (struct gui_data *)data; term_pwron(inst->term, TRUE); if (inst->ldisc) - ldisc_send(inst->ldisc, NULL, 0, 0); + ldisc_echoedit_update(inst->ldisc); } void copy_all_menuitem(GtkMenuItem *item, gpointer data) @@ -3081,7 +3088,7 @@ void change_settings_menuitem(GtkMenuItem *item, gpointer data) */ if (inst->ldisc) { ldisc_configure(inst->ldisc, inst->conf); - ldisc_send(inst->ldisc, NULL, 0, 0); + ldisc_echoedit_update(inst->ldisc); } /* Pass new config data to the terminal */ term_reconfig(inst->term, inst->conf); @@ -3917,7 +3924,7 @@ int pt_main(int argc, char **argv) start_backend(inst); - ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */ + ldisc_echoedit_update(inst->ldisc); /* cause ldisc to notice changes */ /* now we're reday to deal with the child exit handler being * called */