Add VIRT_VIEWER_ERROR GError
Add virt_viewer_compare_version()
Allow app_initial_connect() to raise an error
file: add version field, raise an error if incompatibily

The virt-viewer connection file can now have a version=0.5 field. If
the virt-viewer version opening the connection doesn't provide at
least that version, an error is raised with the version required.
Delete browser plugin entirely

The browser plugin code has been effectively unmaintained since
the day it was merged. There has always been a caveat that the
code has not been properly audited to ensure it is secure, and
being unmaintained doesn't give a warm secure feeling. These
days there are better solutions for the browser which are pure
HTML5 code, noVNC and SPICE-HTML5.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Don't override G_LOG_DOMAIN=all

If the string is different, the GLib log handler will not log all
messages.
spice: update fullscreen state on display creation

This ensure self->priv->auto_resize has correct value.
And allow changing guest resolution when started in fullscreen.

https://bugzilla.redhat.com/show_bug.cgi?id=873298
virt-viewer-display: Add monitor property

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
virt_viewer_window_enter_fullscreen: Pass in monitor for fullscreen window

Rather then passing in a move boolean + coordinates to move the window
to for fullscreen mode, simply pass in the monitor, so that the underlying
objects can also use the monitors size to determine the display size.

Note: pass in -1 to use the monitor the window is currently on.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
virt-viewer-display-spice: Use display monitor property for fullscreen size

When a display is pinned to a certain monitor for fullscreen, it will be moved
there when going fullscreen. Currently we use gdk_screen_get_monitor_at_window
to determine which monitor we are on and get the size from that monitor.

But this is racy, sometimes the size_allocate function runs before the move
has finished and we get the size from the wrong monitor:
https://bugzilla.redhat.com/show_bug.cgi?id=918570

Since if the display is pinned to a certain monitor, the display will always
end up on that monitor we can avoid the race by simply using that monitors
size.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Fix compilation with older gtk+

gtk_widget_get_mapped is only available in gtk+ 2.20, so we need
a compat definition for older releases.
Fix compilation with older glib versions

Recent commits introduced use of g_clear_object and
g_byte_array_new_take which are only present respectively in glib
2.28 and 2.32
virt-viewer-window: Store the monitor locally

With commit 81ed9d13 "virt_viewer_window_enter_fullscreen: Pass in monitor for
fullscreen window" we need a monitor number to determine where to move
the window when going fullscreen.

Since the VirtViewerDisplay needs to know the fullscreen monitor number too,
to determine the fullscreen size it was being stored there. But we don't
always have a display, leading to errors like:

(remote-viewer:7996): remote-viewer-CRITICAL **:
virt_viewer_display_get_monitor: assertion `VIRT_VIEWER_IS_DISPLAY(self)'
failed

And to the monitor number not always being stored. This patchset fixes this
by storing the monitor number inside VirtViewerWindow, and passing it to
VirtViewerDisplay only when we've a display.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
virt-viewer-window: Don't use priv->display when it is NULL

Add some missing checks for not having a display. Note that where
functions should not be called (ie menu items should be disabled) I've
used g_return_if_fail.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
virt-viewer-display: Document difference between nth display and monitor

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
virt-viewer-app: Call virt_viewer_app_update_menu_displays on show_hint change

Since the sensitivity of the display menu-check-items depends on show_hint,
we need to call virt_viewer_app_update_menu_displays on show_hint change.

This fixes the following scenario:
1) Linux guest with upto 4 displays on a single qxl dev
2) Configure it for 2 displays
3) Switch to a text-console in the guest (ie send ctrl+alt+F3)
4) All displays except for disp 1 are now not sensitve in the menu
5) Switch back to X
6) The second display in the view->displays menu is still not sensitive

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Forward directly key events to display

Even if the display is disabled, we should keep sending key events to
guest. It can wake up from sleep for instance.

There is a single widget per window, so we can directly send key
events there. If the menu is active, it has the grab, so the window
doesn't receive those key events.

https://bugzilla.redhat.com/show_bug.cgi?id=870710
virt-viewer-display-spice: Skip monitor info in fullscreen-auto-conf mode

When we are in fullscreen-auto-conf virt-viewer-session-spice sends a
monitor-info message to the agent with the exact client monitor info, and
virt-viewer-display-spice should not override that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
spice: always send auto-conf on agent connection

Restore the auto-conf client monitor configuration whenever the agent
is started. This ensures the guest has the expected number of monitors
enabled when rebooting in fullscreen.

https://bugzilla.redhat.com/show_bug.cgi?id=918997
Do not disable extra client monitors

This allows reconfiguration of extra monitors whenever the agent is
back, for example after reboot.

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