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

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



# 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");
+	}
 
 	if (!viewer->window) {
 		gtk_container_add(GTK_CONTAINER(viewer->container), GTK_WIDGET(notebook));
@@ -763,9 +770,9 @@
 	g_return_if_fail(viewer->display->widget != NULL);
 
 	notebook = glade_xml_get_widget(viewer->glade, "notebook");
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 1);
-
 	gtk_widget_show(viewer->display->widget);
+	gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook),
+				      viewer->display->need_align ? 1 : 2);
 }
 
 static void viewer_connect_info_free(VirtViewer *viewer)
diff -r 4ac66a955d7b -r c70342548912 src/viewer.glade
--- a/src/viewer.glade	Tue Nov 30 13:59:01 2010 +0100
+++ b/src/viewer.glade	Tue Nov 30 15:57:23 2010 +0100
@@ -332,6 +332,23 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">page 3</property>
+              </widget>
+              <packing>
+                <property name="type">tab</property>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
           </widget>
           <packing>
             <property name="position">1</property>


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