[stream] More fixups

Towards an abstract file descriptor.
[stream] Add a stdio-based buffered implementation

Should be fairly solid, though more testing will help.
The buffering in stdio makes most of the syscalls go away.
Most remaining are the lseek() syscalls caused by fseek()
calls for when moving backward in the buffer.  I think
it's a bug in stdio to make those syscalls when the result
is cached anyway.  Anyway, this is a huge improvement
already, specially when reading the buffer forward.
[stream] Use unlocked stdio when available
emulation: Add support for DEC 1007 to set the alternate scroll mode

By default, the mouse wheel sends cursor up/down keycodes in the
alternate screen. This adds an escape sequence (DEC 1007) that allows
turning this off (and on again).

For compatibility with ubuntu's ******** patched vte, also add a
(deprecated, skip) public API that has the expected name but does nothing.

Based on patches from ubuntu, and Egmont Koblinger.

https://bugzilla.gnome.org/show_bug.cgi?id=518405
https://bugzilla.gnome.org/show_bug.cgi?id=709060