Fix inaccurate error message.
[sgt/putty] / unix / gtkwin.c
index 4569788..6d843ef 100644 (file)
@@ -75,6 +75,7 @@ struct gui_data {
     int mouseptr_visible;
     int busy_status;
     guint term_paste_idle_id;
+    guint term_exit_idle_id;
     int alt_keycode;
     int alt_digits;
     char wintitle[sizeof(((Config *)0)->wintitle)];
@@ -1220,9 +1221,9 @@ void frontend_keypress(void *handle)
        exit(0);
 }
 
-void notify_remote_exit(void *frontend)
+static gint idle_exit_func(gpointer data)
 {
-    struct gui_data *inst = (struct gui_data *)frontend;
+    struct gui_data *inst = (struct gui_data *)data;
     int exitcode;
 
     if (!inst->exited &&
@@ -1244,6 +1245,16 @@ void notify_remote_exit(void *frontend)
        }
        gtk_widget_show(inst->restartitem);
     }
+
+    gtk_idle_remove(inst->term_exit_idle_id);
+    return TRUE;
+}
+
+void notify_remote_exit(void *frontend)
+{
+    struct gui_data *inst = (struct gui_data *)frontend;
+
+    inst->term_exit_idle_id = gtk_idle_add(idle_exit_func, inst);
 }
 
 static gint timer_trigger(gpointer data)
@@ -1629,6 +1640,9 @@ void write_clip(void *frontend, wchar_t * data, int *attr, int len, int must_des
 
     if (gtk_selection_owner_set(inst->area, GDK_SELECTION_PRIMARY,
                                inst->input_event_time)) {
+#if GTK_CHECK_VERSION(2,0,0)
+       gtk_selection_clear_targets(inst->area, GDK_SELECTION_PRIMARY);
+#endif
        gtk_selection_add_target(inst->area, GDK_SELECTION_PRIMARY,
                                 GDK_SELECTION_TYPE_STRING, 1);
        if (inst->pasteout_data_ctext)