Commit Graph

20 Commits

Author SHA1 Message Date
Daniel P. Berrange
c1af3ab0cc Fix scaling of window to avoid integer truncation
Use round() instead of integer truncation when scaling the window,
to avoid floating point precision problems on i386
2012-04-19 16:18:31 +01:00
Zeeshan Ali (Khattak)
6109d5257d Minor simplification/optimization of VirtViewerDisplay 2012-04-05 09:24:59 +01:00
Daniel P. Berrange
831ebf5dab Fix close of VNC displays
When clicking the close button on a virt-viewer window with
a VNC session open, while the VNC session terminates, the
window does not go away.

The problem is that the virt_viewer_session_vnc_disconnected
method never gets invoked. The close button triggers a call
to virt_viewer_session_clear_displays which unrefs the
VirtViewerDisplayVnc instance. This in turn triggers a call
to gtk_container_destroy, which destroys all widgets it
contains, ie the VncDisplay * object.

With the VncDisplay object in its dispose phase, no signals
will ever be emitted, thus the 'vnc-disconnected' signal
never gets seen.

The design issue is that VirtViewerDisplayVnc is assuming
it owns the VncDisplay, whereas in fact the real owner is
the VirtViewerSessionVnc object.

The solution is to introduce a new virt_viewer_display_close
method which can be used to de-parent the widget before
VirtViewerDisplay is unref'd.

The VirtViewerSessionVnc object also needs to hold a full ref
on the VncDisplay object, not merely a floating reference

* virt-viewer-display-spice.c, virt-viewer-display.c,
  virt-viewer-display.h: Add virt_viewer_display_close
* virt-viewer-display-vnc.c: Deparent VNC widget in
  virt_viewer_display_close impl
* virt-viewer-session-vnc.c: Improve logging
* virt-viewer-session.c: Call virt_viewer_display_close
  before unrefing display
* virt-viewer-window.c: Improve logging

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-04 10:41:32 +01:00
Hans de Goede
0fa14f928e virt-viewer-display: Use a borrowed reference to session
Before this patch there was a cyclic reference between VirtViewerSesion and
VirtViewerDisplay, since all VirtViewerDisplays are created / destroyed by
VirtViewerSession it is safe to assume that lifetime of VirtViewerSession >=
VirtViewerDisplay, so VirtViewerDisplay can take a borrowed reference
breaking the circle, and allowing proper cleanup on exit.

Note that there is no g_object_unref removed from virt-viewer-display, this
because there is no finalize / dispose and before this patch
VirtViewerDisplay never unref-ed the reference it hold to the session.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-06 12:55:30 +01:00
Marc-André Lureau
6c916253ee Add smartcard-{insert,remove} and release-cursor virtual methods 2012-02-22 16:44:11 +01:00
Marc-André Lureau
bbf040b777 Do not resize guest desktop if !auto-resize
If auto-resize is enabled, the guest desktop size will be resized to
match current window*zoom size.

This can be a problem if the user explicitely set the desktop size to
a different resolution and want to keep it. Disabling auto-resize
sounds like a simple way to allow that.
2012-02-08 17:15:20 +00:00
Daniel P. Berrange
50632ea038 Implement SPICE desktop resizing that takes account of zoom level
The standard SPICE widget guest resize implementation does not
take into account the zoom level settings in virt-viewer, because
it has no knowledge of this functionality. The guest resize can,
however, be done by calling spice_main_set_display() directly.
This allows virt-viewer to resize the guest taking into account
zoom levels.

 ie, if virt-viewer is run with --zoom 50 and the window
     is resized to 400x300, then the guest agent should
     be told to set its resolution to 800x600
2012-02-08 13:23:48 +00:00
Daniel P. Berrange
3a8cdd901f Revert support for resizing guest desktop
The SpiceDisplay widget has built-in support for resizing the
guest desktop, but this does not know that virt-viewer has a
zoom level setting. This makes the virt-viewer zoom completely
inoperable. Revert use of the 'resize-guest' property.
2012-02-07 17:08:37 +00:00
Daniel P. Berrange
a893d5ef61 Update copyright headers 2012-02-06 12:42:18 +00:00
Daniel P. Berrange
e1283a9a60 Convert TABS to spaces & reindent everywhere 2012-02-06 12:40:09 +00:00
Marc-André Lureau
0e6f0847d8 Grab the focus when showing the display
Override the grab_focus() method in the display class. Since both VNC
and Spice displays are the direct child, let's just grab the child.
It can be that this behaviour need to be overriden if Spice or VNC
display become more complex (using sub-childs or different objects)
2012-02-06 12:28:05 +00:00
Guannan Ren
c61981540d Tune the first argument in calls to g_type_class_add_private() 2012-01-31 14:34:47 +00:00
Marc-André Lureau
c285624bb0 Resize guest desktop with SPICE
This is the method we prefer, even though we can't keep aspect ratio.
We could eventually support aspect ration in spice-gtk.
2012-01-31 13:19:29 +00:00
Marc-André Lureau
1175841df9 Emit display-desktop-resize from set_desktop_size() 2011-11-07 12:12:53 +00:00
Marc-André Lureau
0430430284 Add show-hint property to display 2011-07-26 12:00:28 +01:00
Marc-André Lureau
c7ad98333d Split VirtViewerApp window into VirtViewerWindow 2011-07-26 11:16:34 +01:00
Daniel P. Berrange
1def55556f Split pull part of VirtViewerDisplay out into VirtViewerSession
To facilitate introduction of multi-head support, pull some of
the VirtViewerDisplay class out into a new VirtViewerSession
class.
2011-07-11 20:03:32 +01:00
Daniel P. Berrange
4ba39d0224 Remove circular dependancy between VirtViewerDisplay and VirtViewer
Add many signals to VirtViewerDisplay which are emitted when various
events occur. This lets us remove all the code in the VirtViewerDisplay
subclasses which call back into VirtViewer methods. Instead VirtViewer
can simply connect signals to the display
2011-07-11 15:35:47 +01:00
Daniel P. Berrange
7a7112a9fa Turn VirtViewerDisplay into a proper Gtk widget
Turn VirtViewerDisplay into a Gtk widget instead of just a GObject,
by merging the functionality from VirtViewerAlign
2011-07-11 14:10:07 +01:00
Daniel P. Berrange
f3fa999769 Introduce standard naming convention to files & methods
All source files must be named

  virt-viewer-XXXX

All methods named

  virt_viewer_XXX
2011-07-01 16:12:20 +01:00