]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - unix/gtkwin.c
Key rollover: rewrite the PGP keys manual appendix.
[PuTTY.git] / unix / gtkwin.c
index 4f626cbe1ace982cd4612c8d87f9d1a1c112cec8..1c29b41eab2d6dc6371a465d82abcf8e82f69a19 100644 (file)
@@ -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;
 }
@@ -2907,6 +2914,12 @@ void uxsel_input_remove(int id) {
     gdk_input_remove(id);
 }
 
+int frontend_is_utf8(void *frontend)
+{
+    struct gui_data *inst = (struct gui_data *)frontend;
+    return inst->ucsdata.line_codepage == CS_UTF8;
+}
+
 char *setup_fonts_ucs(struct gui_data *inst)
 {
     int shadowbold = conf_get_int(inst->conf, CONF_shadowbold);