Refactor: Make uri_to_remote_recorder more declarative

The function was getting rather long so I decided to refactor it mistaking
it for `uri_to_remote` which I'd planned to modify.  Arguably this is
still an improvement reducing the number of lines by 14.
Refactor: Make `uri_to_remote` more declarative

The function was getting rather long so I decided to refactor it before
adding the new remote type `X11Remote`.  This is more declarative.
Remotes: Add support for sending keys to X11

Can be used with GStreamer's ximagesrc for desktop automation, testing
applications, websites and set-top-box UIs written in HTML5.
test_x11_remote: Tear down Xorg & xterm in event of test failure

Otherwise the next time you run the tests it says "Skipped: There is
already a display server running on :99".
test_x11_remote: Fix finding xterm on Mac OS X

Running this test on OS X requires installing XQuartz[1], which installs
xterm into /opt/X11/bin. (You'll also have to install xdotool using
macports or similar.)

[1]: http://xquartz.macosforge.org/
Merge pull request #173 from wmanley/control-xdotool

Add support for sending keypresses to X11