mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 11:02:48 -05:00
Revamp the terminal paste mechanism using toplevel callbacks.
I've removed the ad-hoc front-end bodgery in the Windows and GTK ports to arrange for term_paste to be called at the right moments, and instead, terminal.c itself deals with knowing when to send the next chunk of pasted data using a combination of timers and the new top-level callback mechanism. As a happy side effect, it's now all in one place so I can actually understand what it's doing! It turns out that what all that confusing code was up to is: send a line of pasted data, and delay sending the next line until either a CR or LF is returned from the server (typically indicating that the pasted text has been received and echoed) or 450ms elapse, whichever comes first. [originally from svn r10020]
This commit is contained in:
@ -93,7 +93,6 @@ struct gui_data {
|
||||
int ignore_sbar;
|
||||
int mouseptr_visible;
|
||||
int busy_status;
|
||||
guint term_paste_idle_id;
|
||||
guint term_exit_idle_id;
|
||||
guint toplevel_callback_idle_id;
|
||||
int alt_keycode;
|
||||
@ -1999,28 +1998,12 @@ void selection_received(GtkWidget *widget, GtkSelectionData *seldata,
|
||||
|
||||
term_do_paste(inst->term);
|
||||
|
||||
if (term_paste_pending(inst->term))
|
||||
inst->term_paste_idle_id = gtk_idle_add(idle_paste_func, inst);
|
||||
|
||||
if (free_list_required)
|
||||
XFreeStringList(list);
|
||||
if (free_required)
|
||||
XFree(text);
|
||||
}
|
||||
|
||||
gint idle_paste_func(gpointer data)
|
||||
{
|
||||
struct gui_data *inst = (struct gui_data *)data;
|
||||
|
||||
if (term_paste_pending(inst->term))
|
||||
term_paste(inst->term);
|
||||
else
|
||||
gtk_idle_remove(inst->term_paste_idle_id);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void get_clip(void *frontend, wchar_t ** p, int *len)
|
||||
{
|
||||
struct gui_data *inst = (struct gui_data *)frontend;
|
||||
|
Reference in New Issue
Block a user