On 23/12/2016 16:12, Michal Suchanek wrote: > This copies the timer hack from ui/console.c kbd_send_chars to ui/gtk.c > gd_vc_in. > > There is no fd-like object to peek repatedly so the paste data is saved > in a free-floating buffer only submitted to gtk_timeout_add. Multiple > pastes can potentially interleave if qemu blocks for long or the user > pastes fast.
Do not use a timer, instead set chr->chr_accept_input in gd_vc_handler. The callback can do basically what you are doing in gd_vc_in_timer. The buffer can be just a GString plus a "head" pointer, in VirtualConsole. Once the head catches up with the tail, you can free the GString. Paolo