Prefer virDomainOpenGraphicsFD for --attach

The virDomainOpenGraphics API cannot label the socket
we pass to it. Prefer virDomainOpenGraphicsFD (if building
with libvirt 1.2.8 or later) which creates the socket for us
and works with SELinux too.

Fall back to the old API if the new one is unsupported
(i.e. the libvirtd on the host is older than the libvirt version
virt-viewer was compiled against).

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1141228

Signed-off-by: Ján Tomko <jtomko@redhat.com>
ovirt: Allow to remove CD images

It turns out this is supposed to be done through update requests with a
CD image with an empty name, which is what the current code tries to do.
The only reason it's not working is because of server-side bugs with
oVirt < 3.5
The requirement on libgovirt is raised to 0.3.2 as
a small change is needed as well in libgovirt to allow empty filenames:
https://git.gnome.org/browse/libgovirt/commit/?id=bdb788fcc

Without this change, nothing too bad will happen, but the CD won't be
removed and warnings will be logged in the console.
Fix 'seperate' typo in man page/comments
man: Improve doc for 'ca' in .vv files

Make it clearer that this CA will be used to validate the certificate
presented by the remote SPICE host when using TLS.
man: Document [ovirt] section in .vv files

Add documentation for these options even though they are mainly meant to
be set by the oVirt portal when it generates the .vv file.
Show VM chooser dialog when oVirt VM name is missing

When a user tries to connect to ovirt without specifying
VM name (remote-viewer ovirt://ovirt.example.com) or with
wrong VM name a list of available virtual machines is shown,
and the user may pick a machine he wants to connect to.
Show VM chooser dialog when starting virt-viewer with no arg

When user starts virt-viewer without specifying VM domain name
or with a wrong name a list of running machines is shown
and user may choose one of them.
Ask for username when connecting with SASL

When connecting with SASL for authentication, some authentication
mechanisms need a username (the plain text and md5 ones, for example).
Use 'username' property from .vv file for spice-session
Prefill the username in the authentication dialog

Lets prefill the username entry using the user name of the
current user.
Use socat instead of nc if possible

It turns out that nc does not leave on server disconnect, and there
doesn't seem to be any option to do that, leaving client open, and
a bunch of idle processes.

Replacing nc with socat solves that, client is disconnected when
the VM is shut down, when the sever connection is closed.

https://bugzilla.redhat.com/show_bug.cgi?id=1030487
Force display_show_hint() when the display is set

Since a window is not created at startup for each display, the first
display(s) set when the application is opened will never receive and
treat the "notify::show-hint" signal on VirtViewerWindow, once the
callback is only set when the display is set to the specific window.
It causes problems like the "Send Key" menu not activated till an extra
display is added. To avoid this problem, let's force a call to
display_show_hint() everytime a display is set.

Resolves: rhbz#1152468
https://bugzilla.redhat.com/show_bug.cgi?id=1152468
Fix bug with initial placement of fullscreen windows

The function app_window_try_fullscreen() will lookup the initial monitor
for the nth monitor internally, so we should pass in the display ID to the function
rather than the mapped monitor ID. This was causing 2 monitors on the
same monitor with a configuration like this:

    monitor-mapping=1:2;2:1
Don't disable "send key" menu when display isn't ready

The ability to send a keystroke should not depend on whether a display
is ready or not, it only depends on whether the display exists or not.

See https://bugzilla.redhat.com/show_bug.cgi?id=1152574
Check for the right spice version in session-spice.c

We have to check for the spice version where the
SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME was introduced and
not for the one where spice_channel_get_error() was introduced.
spec: Update/optimize mime scriptlets
man: Improve documentation for 'version' field in vv files
Move monitor alignment function to util header
Shift top-left display to origin

When using a custom fullscreen display configuration, it's possible to
specify that e.g. a single screen should be fullscreen on client
monitor #4. Since we send down absolute positions and disable alignment
when all windows are in fullscreen, we can send configurations with a
very large offset to the top-left corner. This could result in the guest
trying to create a screen that was much larger than necessary. For
example when sending a configuration of 1280x1024+4240+0, the guest
would need to allocate a screen of size 5520x1024, which might fail if
video memory was too low. To avoid this issue, we shift all displays
so that the minimum X coordinate for all screens is at x=0, and the
minimum y coordinate is at y=0.
Don't try to re-configure displays when there are none

virt_viewer_session_on_monitor_geometry_changed() gets called
immediately upon agent connection, but sometimes this is before any
displays have been received. Simply return early when this is the case.