[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH 5 of 5] viewer: add support for spice resize-guest



On Tue, Nov 30, 2010 at 04:08:33PM +0100, Marc-André Lureau wrote:
> # HG changeset patch
> # User Marc-André Lureau <marcandre lureau redhat com>
> # Date 1291129043 -3600
> # Node ID c70342548912fdd4a7db841dedf54753c756229e
> # Parent  4ac66a955d7bf718ce85e8ffd0be00f0c4ad8ac6
> viewer: add support for spice resize-guest
> 
> And also turn on clipboard sharing.
> 
> diff -r 4ac66a955d7b -r c70342548912 src/display-spice.c
> --- a/src/display-spice.c	Tue Nov 30 13:59:01 2010 +0100
> +++ b/src/display-spice.c	Tue Nov 30 15:57:23 2010 +0100
> @@ -211,6 +211,8 @@
>  		g_object_set(self->display,
>  			     "grab-keyboard", TRUE,
>  			     "grab-mouse", TRUE,
> +			     "resize-guest", TRUE,
> +			     "auto-clipboard", TRUE,
>  			     NULL);
>  		viewer_add_display_and_realize(display->viewer);
>  		viewer_initialized(display->viewer);
> @@ -262,6 +264,7 @@
>  	self = g_object_new(VIRT_VIEWER_TYPE_DISPLAY_SPICE, NULL);
>  	d = VIRT_VIEWER_DISPLAY(self);
>  	d->viewer = viewer;
> +	d->need_align = FALSE;
>  
>  	self->session = spice_session_new();
>  	g_signal_connect(self->session, "channel-new",
> diff -r 4ac66a955d7b -r c70342548912 src/display-vnc.c
> --- a/src/display-vnc.c	Tue Nov 30 13:59:01 2010 +0100
> +++ b/src/display-vnc.c	Tue Nov 30 15:57:23 2010 +0100
> @@ -264,6 +264,7 @@
>  	d->viewer = viewer;
>  	viewer->display = d;
>  
> +	d->need_align = TRUE;
>  	d->widget = vnc_display_new();
>  	self->vnc = VNC_DISPLAY(d->widget);
>  	vnc_display_set_keyboard_grab(self->vnc, TRUE);
> diff -r 4ac66a955d7b -r c70342548912 src/display.h
> --- a/src/display.h	Tue Nov 30 13:59:01 2010 +0100
> +++ b/src/display.h	Tue Nov 30 15:57:23 2010 +0100
> @@ -49,6 +49,7 @@
>  /* perhaps this become an interface, and be pushed in gtkvnc and spice? */
>  struct _VirtViewerDisplay {
>  	GObject parent;
> +	gboolean need_align;
>  	VirtViewer *viewer;
>  	GtkWidget *widget;
>  };
> diff -r 4ac66a955d7b -r c70342548912 src/viewer.c
> --- a/src/viewer.c	Tue Nov 30 13:59:01 2010 +0100
> +++ b/src/viewer.c	Tue Nov 30 15:57:23 2010 +0100
> @@ -130,8 +130,15 @@
>  	g_return_if_fail(viewer->display->widget != NULL);
>  
>  	notebook = glade_xml_get_widget(viewer->glade, "notebook");
> -	align = glade_xml_get_widget(viewer->glade, "display-align");
> -	gtk_container_add(GTK_CONTAINER(align), viewer->display->widget);
> +	if (viewer->display->need_align) {
> +		align = glade_xml_get_widget(viewer->glade, "display-align");
> +		gtk_container_add(GTK_CONTAINER(align), viewer->display->widget);
> +	} else {
> +		gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 2);
> +		if (gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), viewer->display->widget,
> +					     NULL, 2) == -1)
> +			g_warning("failed to insert a notebook page");
> +	}

Could you explain a little more why SPICE doesn't want to be
inside an alignment widget. In VNC we use that to ensure that
you get either vertical or horizontal black bars if the window
is resized to a non-guest native aspect ratio. How does spice
deal with resizing & scaling & aspect ratios ?

Daniel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]